docs(ci): cache Playwright browsers in the GitHub Actions web workflow
Merged
KA
1mo ago+19+19+01234567890123456789-1-1-0123456789
What and why
- The GitHub Actions web workflow in
docs/ci/github-actions.mdxand its copy inskills/e2e/references/running.mdnow cache~/.cache/ms-playwright, keyed on the runner OS, CPU architecture, andpnpm-lock.yaml. - On a cache hit,
pnpm exec e2e-web install chromium --with-depsfinds the browsers and downloads nothing;--with-depsstill installs the system libraries. The lockfile pins@e2e-dev/weband its Playwright, so a version bump changes the key and downloads fresh browsers.runner.archis in the key because Playwright's browser folders don't name the CPU, so an x64 and an arm64 job would otherwise restore each other's Chromium. - An
e2epatch changeset ships the skill change, since the package bundlesskills/e2e/. - This follows @kdy1's CI speedups for this repo (#1530, #1569) in a form a user can copy.
--only-shellis left out becausee2e-web installaccepts only--with-deps. The apt cache is left out because it needs a 77-line composite action.
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
Verified
Ran it locally: yes, the install command, not the workflow on Actions.
- Built
@e2e-dev/web, then ranpnpm exec e2e-web install chromiumfromapps/testbedtwice against an emptyPLAYWRIGHT_BROWSERS_PATH, the second time standing in for a restored cache:
| Run | Downloads | Time |
|---|---|---|
| empty cache | ffmpeg, Chromium, headless shell | 20.3 s |
| cache present | none | 0.2 s |
pnpm docs:checkandpnpm plugins:checkpass.- Not run on GitHub Actions; the step is the stock
actions/cacheusage at the SHA the mobile workflow on this page already pins.