|
| 1 | +# Cross-platform CI for pi-agenticoding |
| 2 | +# |
| 3 | +# Runs the full unit suite on Linux, macOS, and Windows |
| 4 | +# on the minimum Node.js version required by pi coding agent. Snapshot |
| 5 | +# tests verify TUI render output against golden files. |
| 6 | + |
| 7 | +name: test |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +on: |
| 17 | + push: |
| 18 | + branches: [main] |
| 19 | + paths-ignore: ['*.md', '**/docs/**'] |
| 20 | + pull_request: |
| 21 | + branches: [main] |
| 22 | + paths-ignore: ['*.md', '**/docs/**'] |
| 23 | + |
| 24 | +jobs: |
| 25 | + # ── Quick-check gate — catch trivial failures before the full matrix ── |
| 26 | + quick-check: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 30 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 31 | + with: |
| 32 | + node-version: "22" |
| 33 | + cache: "npm" |
| 34 | + - run: npm ci |
| 35 | + |
| 36 | + # Fast pre-flight checks — type errors and security issues before matrix |
| 37 | + - name: Type check |
| 38 | + run: npx tsc --noEmit |
| 39 | + |
| 40 | + - name: Security audit |
| 41 | + run: npm audit --audit-level=moderate |
| 42 | + |
| 43 | + # ── Cross-platform test matrix ────────────────────────────────────── |
| 44 | + # Node 22 (minimum) is tested only on Linux — the primary platform and the only one |
| 45 | + # guaranteed to have the oldest toolchain. macOS and Windows test Node 24 (latest) |
| 46 | + # to catch regressions in the newest runtime. This asymmetry is intentional: it |
| 47 | + # balances CI cost with meaningful coverage while ensuring the minimum version works |
| 48 | + # correctly on the platform most likely to encounter toolchain edge cases. |
| 49 | + test: |
| 50 | + needs: quick-check |
| 51 | + runs-on: ${{ matrix.os }} |
| 52 | + strategy: |
| 53 | + fail-fast: false # report every combination, don't cancel |
| 54 | + matrix: |
| 55 | + include: |
| 56 | + - os: ubuntu-latest |
| 57 | + node-version: "22" # minimum version on primary platform |
| 58 | + - os: ubuntu-latest |
| 59 | + node-version: "24" # latest on primary platform |
| 60 | + - os: macos-latest |
| 61 | + node-version: "24" # latest on macOS |
| 62 | + - os: windows-latest |
| 63 | + node-version: "24" # latest on Windows |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 66 | + |
| 67 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 68 | + with: |
| 69 | + node-version: ${{ matrix.node-version }} |
| 70 | + cache: "npm" |
| 71 | + |
| 72 | + - run: npm ci |
| 73 | + |
| 74 | + # Unit suite (unit tests + snapshot tests + property-based tests) |
| 75 | + - name: Unit tests |
| 76 | + run: npm test |
| 77 | + |
| 78 | + # E2E tests — process-isolated child-process harness (stdin/stdout, no PTY). |
| 79 | + # Verified cross-platform: runs on Linux, macOS, and Windows. |
| 80 | + # See https://github.com/agenticoding/pi-agenticoding/issues/12 |
| 81 | + - name: E2E tests |
| 82 | + run: npm run test:e2e |
| 83 | + |
| 84 | + # Upload test results for debugging — artifacts available for 30 days. |
| 85 | + - name: Upload test results |
| 86 | + if: always() |
| 87 | + uses: actions/upload-artifact@v4 |
| 88 | + with: |
| 89 | + name: test-results-${{ matrix.os }}-node-${{ matrix.node-version }} |
| 90 | + path: | |
| 91 | + test-results/ |
| 92 | + tests/__snapshots__/ |
| 93 | + retention-days: 30 |
0 commit comments