test: add comprehensive edge-case unit tests for jira-utils #3427
Workflow file for this run
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
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize, reopened] | |
| # Cancel outdated runs on the same PR/branch to save CI minutes | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ── 1. Type check ────────────────────────────────────────────────────────── | |
| typecheck: | |
| name: Type check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tsc | |
| run: npm run type-check | |
| # ── 2. Lint ──────────────────────────────────────────────────────────────── | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run ESLint | |
| run: npm run lint | |
| # ── 3. Build ─────────────────────────────────────────────────────────────── | |
| # Catches: missing modules, bad JSX, broken dynamic imports, and anything | |
| # tsc misses (e.g. a package present locally but absent from package.json). | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| env: | |
| # Dummy values — API routes are force-dynamic and only run at request | |
| # time, not build time, so these are never actually used. | |
| NEXTAUTH_SECRET: ci-placeholder-secret-that-is-long-enough-32c | |
| NEXTAUTH_URL: http://localhost:3000 | |
| GITHUB_ID: ci-placeholder | |
| GITHUB_SECRET: ci-placeholder | |
| NEXT_PUBLIC_SUPABASE_URL: https://placeholder.supabase.co | |
| NEXT_PUBLIC_SUPABASE_ANON_KEY: placeholder-anon-key | |
| SUPABASE_SERVICE_ROLE_KEY: placeholder-service-key | |
| NEXT_PUBLIC_APP_URL: http://localhost:3000 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Next.js app | |
| run: npm run build | |
| # ── 4. Dependency audit ──────────────────────────────────────────────────── | |
| # Checks every third-party import in src/ has a matching entry in | |
| # package.json. Catches the "installed locally but missing from | |
| # package.json" problem (e.g. the jspdf incident on PR #114). | |
| dep-check: | |
| name: Dependency audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check all imports exist in package.json | |
| run: node scripts/check-deps.js | |
| # ── Summary gate ─────────────────────────────────────────────────────────── | |
| # Single status check to add to branch protection rules. | |
| # Branch: main → require "CI passed" before merge. | |
| ci-pass: | |
| name: CI passed | |
| runs-on: ubuntu-latest | |
| needs: [typecheck, lint, build, dep-check] | |
| if: always() | |
| steps: | |
| - name: Check all jobs passed | |
| run: | | |
| if [[ "${{ needs.typecheck.result }}" != "success" || | |
| "${{ needs.lint.result }}" != "success" || | |
| "${{ needs.build.result }}" != "success" || | |
| "${{ needs.dep-check.result }}" != "success" ]]; then | |
| echo "One or more CI jobs failed." | |
| exit 1 | |
| fi | |
| echo "All CI jobs passed." |