Skip to content

Latest commit

 

History

History
71 lines (57 loc) · 4.39 KB

README.md

File metadata and controls

71 lines (57 loc) · 4.39 KB

CI, release and preview tools

The ci package holds the pull request gate, the proof pages, Cloud deploys, releases and previews. Workflows under .github/ only call its commands, and every command runs the same by hand: bun run ci --help lists them and bun run ci <command> --help gives each one's flags. Releases are described in RELEASING.md.

The gate

A pull request has one required result: the gate check. For the pushed commit it runs:

  • checks: every step of bun run check, from the one list in ci/src/contracts/checks.ts;
  • tests: bun run test, and bun run test:hosted for the hosted tests;
  • journeys: the journeys the change reaches, on the change (the head side) and on the commit it merges into (the base side), in a pinned browser image. A head-side failure fails the gate; a base-side failure only leaves that comparison without a "before";
  • admission: new or changed test files and journeys, run many times across the conditions in ci/src/contracts/admission.ts (see proving a change).

The plan. bun run ci gate-plan --base-ref <branch> prints what the gate would run for your commits and why each journey was chosen. A journey is planned when its own files, its feature's map file or the code its product runs changed, when the surface snapshots name an entrypoint its feature claims, or when the journey harness changed (the paths are journeyHarnessPaths in ci/src/contracts/gate-paths.ts). On the default branch every journey runs. A checkpoint is expected to change exactly when its recording changed in the same commit; one that changes when the plan expected no change fails the gate.

Reuse. The gate keeps each step's result under a key made from the step's command, the machine's platform and the step's inputs, and reuses it when a later run has the same key (ci/src/implementation/gate/inputs.ts). For most checks the inputs are the whole commit tree, so any change runs them again; steps with narrower inputs are listed in ci/src/implementation/gate/steps.ts. Never re-run a failed gate to get a pass: the same inputs give the same result.

Adding a step to bun run check

  1. Add it to checkSteps in ci/src/contracts/checks.ts: an id, a name and the command. Both bun run check and the gate run that list, all steps at once, so a step must run with no network beyond loopback.
  2. Show it failing: a test of kind check in ci/test/check-steps.test.ts, declared in ci/test/check-steps.verifies.ts, that runs the step on a small violating input and asserts it names the violation, with a break in ci/test/breaks/ that disables the check. If the step has no small violating input, list it with the reason in policy/src/checks.ts.
  3. Run bun run tests and commit what it regenerates.

Deploys, and what is not there

.github/workflows/cloud-deploy.yml deploys Cloud with bun run ci cloud: on pushes to main and to any stage when started by hand. These no longer exist, and nothing replaces them:

  • deploy events sent to the log service for each production deploy;
  • an issue describing the state of main (the scoreboard, bun run ci scoreboard, shows the state but opens no issue);
  • tests against the deployed Cloud: hosted tests and journeys run Cloud locally with stand-ins;
  • a Cloud test stage per pull request, and the scheduled removal of such stages (private previews of a checkout are bun run ci preview);
  • the workflow that builds the patched Bun runtime (scripts/releases/bun-runtime/README.md).

After a push

bun run ci verdict --sha $(git rev-parse HEAD) --pr <number> waits for the gate's verdict on that commit and prints it with what to do next, and the address of its proof page; its exit codes are in bun run ci verdict --help. bun run ci proof show --pr <number> reads the same proof in a terminal (see proving a change). The page is built by ci/src/implementation/proof-build.ts and drawn by ci/src/implementation/proof-viewer.ts.

A change to the code that produces proof can only get an inconclusive verdict, which the owner reviews: the changed code produced the proof. That code is proofCodePaths in ci/src/contracts/gate-paths.ts. It includes ci/, lab/ and all of journeys/ except the recordings, so a change that adds or edits a journey declaration or body is inconclusive too.