Cache Playwright browsers in CI to avoid redundant downloads#298
Cache Playwright browsers in CI to avoid redundant downloads#298
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Playwright browser binaries were being downloaded fresh on every CI run — 5 times in the parallel web CLI workflow alone. This adds actions/cache@v4 keyed on the Playwright version and OS. On cache hit, only system-level apt dependencies are installed (skipping the ~30-60s browser download). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b394f00 to
7609957
Compare
WalkthroughThis PR adds Playwright browser caching to the CI workflows to avoid redundant browser downloads on every run. It applies the same cache-then-conditional-install pattern to both Changes
Review Notes
🤖 Generated with Claude Code |
There was a problem hiding this comment.
Review: Cache Playwright browsers in CI
This PR only modifies GitHub Actions workflow files — no TypeScript source, commands, or tests were changed, so the CLI command review checklist doesn't apply.
Summary
| File | Status | Notes |
|---|---|---|
.github/workflows/e2e-tests.yml |
OK | Caching added correctly to the single job |
.github/workflows/e2e-web-cli-parallel.yml |
OK | Caching added to all 5 jobs; setup seeds cache, test jobs restore it |
Logic review
The pattern used is the canonical approach for Playwright browser caching:
- Capture Playwright version → use as cache key
- Restore
~/.cache/ms-playwrightfrom cache - On miss:
playwright install --with-deps(downloads browsers + installs system deps) - On hit:
playwright install-deps(only installs system deps, browsers already present)
This is correct. The setup job in e2e-web-cli-parallel.yml runs first and writes the cache; the four downstream test jobs (auth-tests, session-tests, ui-tests, rate-limit-test) all restore from the same key — so only the setup job bears the download cost after the first run.
One observation (not a blocker)
pnpm exec playwright --version outputs Version 1.48.0 (with the Version prefix). The resulting cache key is playwright-Linux-Version 1.48.0 — note the space and capital V. GitHub Actions does allow spaces in cache keys (the docs only prohibit commas), so this won't break anything. If you want a cleaner key you could strip the prefix with pnpm exec playwright --version | sed 's/Version //', but it's not necessary.
Overall
Correct, clean, and well-structured. The setup job seeding the cache for all parallel test runners is the right architecture here. Good to merge.
Summary
actions/cache@v4keyed on Playwright version and OSplaywright install-depsplaywright install --with-depsas beforee2e-tests.yml(1 job) ande2e-web-cli-parallel.yml(5 jobs sharing the same cache key)Why
Playwright browsers were downloaded fresh on every CI run. In the parallel web CLI workflow, this happened 5 times per run. Caching eliminates redundant downloads, speeds up CI, and reduces flakiness from download failures.
🤖 Generated with Claude Code