ci: cache the apt packages Playwright installs for Chromium
Merged
KD
1mo ago+85+85+01234567890123456789-5-5-0123456789
What and why
playwright-core install chromium --with-depsdownloads the same 38.2 MB of.debfiles (17 upgrades, 9 new font packages) from the Ubuntu mirror in every job.- In 38 of 84 recent
specjobs, the mirror served them at about 200 kB/s. The step took 118-302 s instead of 14-45 s. Example from one job log:Fetched 38.2 MB in 3min 13s (198 kB/s), againstFetched 38.2 MB in 5s (8481 kB/s)in a fast job. - The
specgate waits for its slowest job. 13 of 14 recentspecruns had at least one slow install job. - The new
.github/actions/chromiumcomposite action does these steps:- It points apt's archive directory at
/var/cache/chromium-apt(Dir::Cache::Archives). The runner owns the directory, so the cache can restore into it.partialbelongs to_apt:rootwith mode0700, like/var/cache/apt/archives/partial. The runner's temp directory did not work:_aptcannot traverse/home/runner, so apt downloaded as root (W: Download is performed unsandboxed as root). - It restores the newest cache entry for the Ubuntu release, architecture, and Playwright version.
- It runs the same
install --with-depscommand, so apt downloads only the packages whose version changed. - It runs
apt-get autocleanto remove versions that the mirror no longer serves. - It saves the archives under a digest of their file names, but only when the set changed.
- It points apt's archive directory at
- The installed packages do not change, so rendering and screenshot baselines do not change.
- All five install steps use the action:
speccheck and test, both benchmark jobs, and the weekly agent job. Thewebpath filter in.github/filters.ymllists the action.
Issue
No matching issue. This is a CI time optimization.
Verified
Ran it locally: no - CI-only change; the restore, root apt install, and save run only on Actions runners.
- apt archive reuse, checked without root through
apt-get install -dwith the sameDir::Cache::Archivessetting: an empty directory gaveNeed to get 14.7 MB of archives., and a filled directory gaveNeed to get 0 B/14.7 MB of archives. apt-get autocleankept the file-name digest the same for current archives and deleted a planted archive whose version the mirror does not serve.- actionlint 1.7.7 passed on
spec.yml,benchmark.yml, andagent.yml, with the unknown Blacksmith runner label warnings ignored. - CI on the first commit (
d552754d), with the archives in$RUNNER_TEMP/chromium-apt:- The
checkjob missed the cache, downloaded38.2 MB, and savedchromium-apt-ubuntu-24.04-x86_64-playwright-1.64.1-c46104d3e234d6a2. The otherspecjobs that missed gotUnable to reserve cache, as expected. - The later
webjob restored that entry and loggedNeed to get 0 B/38.2 MB of archives. - The
checkjob also loggedW: Download is performed unsandboxed as root.006e60e8fixes this by moving the archives to/var/cache/chromium-apt.
- The
- CI at
006e60e8, with the archives in/var/cache/chromium-apt:- The benchmark
webjob missed the cache, downloaded38.2 MB, and saved the same key. Theunsandboxed as rootwarning was gone. - On a rerun, all 6
specjobs and both benchmark jobs restored the entry and loggedNeed to get 0 B/38.2 MB of archives.The save step was skipped because the key did not change. - Install step per job: min 11 s, median 13.5 s, p75 16 s, max 19 s over 16 jobs. Before this change, 84 jobs gave min 14 s, median 27 s, p75 167 s, max 302 s. The table is in the PR comment.
- The mirror was fast during these runs, so I did not see a slow-mirror job on this branch.
- The benchmark
- A cache that a PR branch saves is visible only to that branch. After merge, a push to
mainsaves the cache that every pull request can restore.
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.
AI assistance and human review
AI was used to prepare these changes. Human-reviewed by @kdy1.
- Harness: Claude Code
- Model: claude-opus-5-5
š¤ Generated with Claude Code