CI and the image publish: build once, cache the dependencies, gate latest on the e2e #49
Loading…
Reference in a new issue
No description provided.
Delete branch "ci/speed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Issue #44: CI and the image publish, each under two minutes.
The fast lane is now under one minute. The service lane and publish are not under two: the in-image e2e alone takes 154–165 s on the runner. The four commits below remove everything else that could be removed from the workflow side. The rest is the e2e itself (test code, not touched here) and the runner's disk.
Before and after
Before: the five develop pushes 262/263 to 272/273 (2026-10-26 to 29). After: this PR's runs 276–282, each building as after a backend-only change (a temporary probe step, dropped from the branch). Step times come from the job view; the build, e2e and push times come from the step logs.
Local
docker build --progress=plainwith a warm cache (Apple M3), before → after: backend-only change 44.6 s → 0.1 s, frontend-only 46.3 s → 3.0 s,pyproject.tomlchange 42.6 s → 21.4 s. On the runner, a cold build of the new Dockerfile (what the first push after apyproject.tomlchange or a new ISO week costs) took 202 s (run 274).Changes
pyproject.tomlalone, then Chromium, then the built page and the code. A code-only change rebuilds and pushes one ~2 MB layer instead of ~1.4 GB. pip and npm downloads sit in BuildKit cache mounts;npm ci;DEPS_REFRESH(the workflows pass the ISO week) rebuilds the dependency layers weekly, since they used to be refreshed on every build. The context leaves outopenspec,docs,brand,.gitea,.claude.actions/setup-python. The venv and Playwright's headless shell, andnode_modules, come fromactions/cache, keyed on the manifest hash, the Python or Node version and the ISO week. It installs only the headless shell, because every test launchesheadless=True. Restoring the full browser took longer than downloading it.make buildruns once, and the pytest lane reuses it.latest. On a develop push, publish-image builds the image, runs the in-image e2e, then pushes:<sha>andlatest. ci's service lane skips develop pushes and still runs on pull requests and main. Before this, a red e2e did not blocklatest:d58803d,0e6bc84andc9631edwere all published with a failed in-image e2e.--network nonefor the in-image e2e. The best-effort try of the real page now fails at once instead of waiting out Cloudflare: 30–33 s → 17–20 s.Guarantees kept:
latestand:<sha>, and only after the e2e passes.Not measured until this is merged
if:was checked only on pull requests, where the job runs).What still stands between this and two minutes
The e2e: 154–165 s on its own. Leg by leg on the runner:
Getting under two minutes needs changes in
backend/tests/e2e_click_to_play.py. For example: skip the real-page try in CI, and run the channel leg (its own app and port) beside part (b).Runner disk. BuildKit's layer commit waits for writeback. While the fast lane extracts its caches, about 750 MB of dirty pages drain at ~30 MB/s, so the 2 MB
COPY backend/takes 25–49 s. Without the fast lane it takes 3 s (run 281). Sequential writes on the same disk run at 485 MB/s; 4 KiB synced writes manage 4.5 MB/s.Flake seen once (run 277): "'Hawks vs. Magic' is not shown on the page". The feed fetch has a 10 s timeout, and it was during one of those stalls. Now that the e2e gates
latest, a flake like this holds a deploy until a re-run.🤖 Generated with Claude Code
9316b96477dd3b9d8bee13d5dfc77bd621d66e02