fast ci: task graph runner, sharded tests balanced by recorded durations, ci:quick (typecheck + related tests + scrub), Rust only when src-tauri / sidecar build changed, event waits instead of sleeps

This commit is contained in:
CRTkafa 2026-10-11 21:05:26 +00:00
parent cde9424ce3
commit c71e690aae
13 changed files with 472 additions and 45 deletions

View file

@ -7,9 +7,25 @@ but fixes, store rule updates and new engines / AI tools are very welcome.
```sh
bun install # Bun 1.1+; playwright is a dev dependency (renders, web capture)
bun run ci # adapters fresh, tests, typecheck, secrets / personal data scrub
bun run ci:quick # inner loop: typecheck + the tests your change touches + scrub (seconds)
bun run ci # full gate before pushing: every check and test (adapters, API tables, typecheck,
# desktop build and boot check, Rust host when it changed, scrub)
```
**Which one when.** Run `bun run ci:quick` while you work: it diffs against `origin/main` (committed, staged,
unstaged and new files), maps the changed files to the tests that import them (directly, through other modules, or
by naming a fixture or page) and runs those, plus `tsc` (incremental) and the scrub. A change to `package.json`,
`bun.lock`, `bunfig.toml`, `tsconfig.json` or the test preload runs every test. Run the full `bun run ci` before every
push and check its exit code: it is the gate, `ci:quick` is not.
`tools/ci.ts` runs the steps as a task graph (independent steps at the same time, output prefixed with the step
name, the first failure stops the rest, a time-per-step summary at the end). The tests run as parallel shards
(CPU cores - 1, at most 8; `STOREBOUND_CI_SHARDS=n` overrides) balanced by the durations of the last run, kept in
`node_modules/.cache/storebound-ci/`; the browser suites get a shard each. So tests must be shard-safe: temp folders
from `mkdtempSync`, servers on port 0, no fixed sleeps (wait for the event), no state shared through files in the
checkout. The desktop Rust host (`cargo test`, `clippy`) runs only when `apps/desktop/src-tauri/` or
`tools/build-sidecars.ts` changed against `origin/main`; `CI=full bun run ci` always runs it (Forgejo CI does).
Try the screenshot and video pipeline on the demo game without any store account: see
[examples/demo-game/README.md](examples/demo-game/README.md).