asyouplz_SpeechNote/.github/workflows/ci.yml
asyouplz cbdb374e9d
chore(ci): update actions for node 24 runners (#77)
Upgrade the GitHub Actions versions used in CI and release workflows so they run on
Node 24 before the hosted runner default changes.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 00:59:05 +09:00

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@v6
- name: Setup Node.js
uses: actions/setup-node@v6
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@v6
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
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@v6
- name: Setup Node.js
uses: actions/setup-node@v6
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@v6
- name: Setup Node.js
uses: actions/setup-node@v6
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!"