name: CI on: push: branches: [main] pull_request: branches: [main] # Manual re-runs: a CI verdict on demand when a branch's run is stale or # was never triggered (API-made commits do not emit pull_request events). workflow_dispatch: concurrency: group: ci-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: # ── Gate 1: the ADR 0001 boundary ──────────────────────────────────────── # Apex Code is a full-tree graft, so the consumed Pi packages physically # live in this repo and are editable by accident. That is the one real risk # of the graft shape, and this job is what makes "do not patch consumed # packages" a build failure rather than a comment. # # It runs first and standalone: it is seconds long, and a boundary violation # should be reported as itself rather than as a confusing downstream failure. frozen-packages: name: Frozen packages match upstream runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with: # Full history + tags: the check diffs the working tree against the # pinned upstream tag, which a shallow clone cannot resolve. fetch-depth: 0 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 with: node-version: 22 - run: node scripts/apex/check-frozen-packages.mjs # ── Gate 2: build, lint, test ──────────────────────────────────────────── build-check-test: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} defaults: run: working-directory: "apex code checkout" strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with: path: "apex code checkout" - name: Assert spaced checkout shell: bash working-directory: "apex code checkout" run: | case "$PWD" in *" "*) ;; *) echo "checkout path must contain a space" >&2; exit 1;; esac - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 with: node-version: 22 cache: npm cache-dependency-path: "apex code checkout/package-lock.json" # Upstream's native deps (canvas/image handling) plus the tools the # coding agent shells out to. Mirrors upstream's own CI. - name: System dependencies (Linux) if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y libcairo2-dev libpango1.0-dev libjpeg-dev \ libgif-dev librsvg2-dev fd-find ripgrep sudo ln -s "$(which fdfind)" /usr/local/bin/fd - name: System dependencies (macOS) if: runner.os == 'macOS' run: brew install cairo pango jpeg giflib librsvg fd ripgrep - name: System dependencies (Windows) if: runner.os == 'Windows' run: choco install ripgrep fd --no-progress -y - name: Install run: npm ci --ignore-scripts - name: Build run: npm run build # Packs the built coding-agent package and installs it into a clean # consumer, so a broken export or a missing built file fails here rather # than in a user's install (HR.26). - name: Package install gate run: npm run check:package-install # `check` is biome (lint + format, warnings are errors) plus upstream's # pinned-dependency and TS-import guards. There is no separate typecheck # script; the build typechecks. - name: Check run: npm run check - name: Test run: npm test - name: Parse standalone PowerShell installer if: runner.os == 'Windows' shell: pwsh run: | $tokens = $null $parseErrors = $null [System.Management.Automation.Language.Parser]::ParseFile( (Join-Path $PWD "install.ps1"), [ref]$tokens, [ref]$parseErrors ) | Out-Null if ($parseErrors.Count -gt 0) { $parseErrors | ForEach-Object { Write-Error $_ } exit 1 }