Repository navigation
🍱 fixed extension #136
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # CI/CD Pipeline - Runs linting, unit tests, build, and E2E tests on push/PR | |
| name: CI/CD Pipeline | |
| # Trigger on all pushes and pull requests | |
| on: | |
| push: | |
| pull_request: | |
| # Cancel redundant runs on same branch/PR to save CI minutes | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Main job: runs lint, unit tests, security audit, and production build | |
| # Both Node versions run in parallel (matrix), not sequentially | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22.x, 24.11.1] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install Dependencies | |
| run: npm install --loglevel=error | |
| # Run lint, tests (with coverage), and security audit in parallel | |
| - name: Lint, Test & Audit | |
| run: | | |
| npm run lint & | |
| npm run test:ci -- --coverage --coverageReporters="json-summary" --coverageReporters="text" & | |
| npm audit --audit-level=high & | |
| wait | |
| - name: Build | |
| run: npm run build | |
| # Generate and commit coverage badge (only on push to main/master, Node 22.x) | |
| - name: Generate Coverage Badge | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && matrix.node-version == '22.x' | |
| run: | | |
| npx coverage-badges-cli --source coverage/coverage-summary.json --output .github/badges/coverage.svg | |
| - name: Commit Coverage Badge | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && matrix.node-version == '22.x' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add .github/badges/coverage.svg | |
| git diff --staged --quiet || git commit -m "chore: update coverage badge [skip ci]" | |
| git push | |
| # E2E job: runs Playwright browser tests (runs in parallel with build-and-test) | |
| e2e-tests: | |
| runs-on: ubuntu-latest | |
| # Split E2E tests into 2 shards for parallel execution | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js 22.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| - name: Install Dependencies | |
| run: npm install --loglevel=error | |
| # Cache Playwright browsers to speed up subsequent runs | |
| - name: Cache Playwright Browsers | |
| uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
| - name: Install Playwright Browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: npx playwright install --with-deps | |
| - name: Install Playwright Dependencies (cached) | |
| if: steps.playwright-cache.outputs.cache-hit == 'true' | |
| run: npx playwright install-deps | |
| # Build test version and run sharded E2E tests | |
| - name: Build & Test | |
| run: | | |
| npm run build:test | |
| npx playwright test --config=config/e2e/playwright.config.js --shard=${{ matrix.shard }}/2 | |
| # Upload test artifacts only on failure for debugging | |
| - name: Upload Playwright Report | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: playwright-report-shard-${{ matrix.shard }} | |
| path: playwright-report/ | |
| retention-days: 7 | |
| - name: Upload Test Results | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: test-results-shard-${{ matrix.shard }} | |
| path: test-results/ | |
| retention-days: 7 |