Skip to content

ci: path-filter self-hosting stage 2/3 for non-codegen PRs #600

@cs01

Description

@cs01

Problem

CI build-macos + build-linux-glibc jobs take 12-14 min each. Vendor is already cached (`actions/cache@v4` on `build-vendor.sh` + `c_bridges/` hash), so the bulk is: stage 0 node compile (~2min) + test:node/test:native (~4min) + self-hosting stages 1/2/3 (~5-6min) + SDK packaging.

Every PR — including docs, fixture additions, benchmark tweaks — pays full stage 2+3 cost. Stage 2 is the bit-exact native oracle; it only catches real bugs when codegen or c_bridges change.

Proposal

Skip stages 2 and 3 in `tests/self-hosting.test.ts` when the PR touches only non-codegen paths.

How

  1. Add env var `CHADSCRIPT_SKIP_STAGE_2_3=1` check at the top of the "Stage 2 smoke test" / "Stage 3 smoke test" / stage-2-all-fixtures suites in `tests/self-hosting.test.ts` — skip the `it` blocks when set.
  2. In `.github/workflows/ci.yml`, before the `Run self-hosting tests` step, compute a `SKIP_STAGE_2_3` boolean via `dorny/paths-filter` (or inline git diff): true iff the PR diff touches ONLY docs/**, *.md, tests/fixtures/**, benchmarks/**, memory/** — AND nothing in src/**, c_bridges/**, scripts/self-hosting.sh, package.json, package-lock.json.
  3. Export that as `CHADSCRIPT_SKIP_STAGE_2_3` when invoking the test step.

What this preserves

  • Stage 1 still runs on every PR (catches stage 0 → stage 1 divergence).
  • Full stages 2+3 on any src/, c_bridges/, scripts/self-hosting.sh, package.json, package-lock.json change.
  • Manual flag to force full run (`[full-hosting]` in commit message, or workflow_dispatch override).

Estimated impact

  • Docs/fixture/bench PRs: ~3-5 min saved per job, on two jobs (macos + linux) = 6-10 min wall-clock.
  • Codegen PRs: no change.

Not in scope

  • `.build/chad` caching (low hit rate; most PRs touch src/).
  • ccache for clang (vendor already cached).
  • test:node/test:native parallelization (risky, test runner work).

Validation plan

  • Open PR with the workflow change + a no-op docs edit. Confirm stage 2+3 is skipped on CI.
  • Open a second PR editing a src/codegen file. Confirm stage 2+3 runs.
  • Merge only after both paths verified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions