mirror of
https://github.com/asyouplz/SpeechNote.git
synced 2026-07-22 16:30:31 +00:00
* refactor: address PR #8004 review comments and fix lint errors * fix: address CI failures and code review feedback * Refactor: comprehensive fix for lint errors and type safety regressions * chore: trigger CI and Claude Code Review workflows
223 lines
6.9 KiB
YAML
223 lines
6.9 KiB
YAML
name: CI Pipeline
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches: [main, develop]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
NODE_VERSION: '18'
|
|
|
|
jobs:
|
|
# 린트 및 타입 체크
|
|
quality-check:
|
|
name: Code Quality Check
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'npm'
|
|
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run ESLint (Obsidian plugin review bot compatible)
|
|
run: |
|
|
echo "🔍 Running ESLint with Obsidian plugin review bot compatible rules..."
|
|
npm run lint 2>&1 | tee lint-output.txt || true
|
|
|
|
# Check if there were any errors (exclude "0 errors" from matching)
|
|
if grep -E "[1-9][0-9]* error" lint-output.txt; then
|
|
echo "❌ ESLint found errors"
|
|
npm run lint
|
|
exit 1
|
|
elif grep -q "warning" lint-output.txt; then
|
|
echo "⚠️ ESLint found warnings"
|
|
npm run lint
|
|
else
|
|
echo "✅ ESLint passed with no errors or warnings"
|
|
fi
|
|
|
|
- name: Check formatting
|
|
run: npm run format:check
|
|
|
|
- name: Type check
|
|
run: npm run typecheck
|
|
|
|
# 유닛 테스트
|
|
unit-tests:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
needs: quality-check
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [18]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-${{ matrix.node-version }}-
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run unit tests
|
|
run: npm run test:unit -- --coverage --passWithNoTests
|
|
continue-on-error: true
|
|
|
|
# 통합 테스트
|
|
integration-tests:
|
|
name: Integration Tests
|
|
runs-on: ubuntu-latest
|
|
needs: quality-check
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'npm'
|
|
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run integration tests
|
|
run: npm run test:integration -- --coverage --passWithNoTests
|
|
continue-on-error: true
|
|
env:
|
|
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
|
|
TEST_API_URL: ${{ secrets.TEST_API_URL }}
|
|
|
|
# 빌드 테스트
|
|
build:
|
|
name: Build Test
|
|
runs-on: ubuntu-latest
|
|
needs: quality-check
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'npm'
|
|
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build project
|
|
run: npm run build
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: build-artifacts
|
|
path: |
|
|
main.js
|
|
manifest.json
|
|
|
|
- name: Check bundle size
|
|
run: |
|
|
echo "Checking bundle size..."
|
|
ls -lh main.js
|
|
size=$(stat -c%s main.js 2>/dev/null || stat -f%z main.js)
|
|
if [ $size -gt 5242880 ]; then
|
|
echo "Bundle size exceeds 5MB limit!"
|
|
exit 1
|
|
fi
|
|
echo "Bundle size OK: $size bytes"
|
|
|
|
# 최종 상태 체크 - 핵심 작업만 검증
|
|
status-check:
|
|
name: Final Status Check
|
|
runs-on: ubuntu-latest
|
|
needs: [quality-check, unit-tests, integration-tests, build]
|
|
if: always()
|
|
|
|
steps:
|
|
- name: Check job statuses
|
|
run: |
|
|
echo "Checking critical job statuses..."
|
|
|
|
# Quality check is required
|
|
if [[ "${{ needs.quality-check.result }}" != "success" ]]; then
|
|
echo "❌ Quality check failed"
|
|
exit 1
|
|
fi
|
|
echo "✅ Quality check passed"
|
|
|
|
# Build is required
|
|
if [[ "${{ needs.build.result }}" != "success" ]]; then
|
|
echo "❌ Build failed"
|
|
exit 1
|
|
fi
|
|
echo "✅ Build passed"
|
|
|
|
# Unit/Integration tests - warn but don't fail
|
|
if [[ "${{ needs.unit-tests.result }}" != "success" ]]; then
|
|
echo "⚠️ Unit tests had issues (non-blocking)"
|
|
else
|
|
echo "✅ Unit tests passed"
|
|
fi
|
|
|
|
if [[ "${{ needs.integration-tests.result }}" != "success" ]]; then
|
|
echo "⚠️ Integration tests had issues (non-blocking)"
|
|
else
|
|
echo "✅ Integration tests passed"
|
|
fi
|
|
|
|
echo ""
|
|
echo "🎉 All critical jobs passed successfully!"
|