Cache Playwright browser binaries in CI#970
Conversation
e1b2345 to
ef8ea73
Compare
The browser-test job downloads Playwright browsers from scratch on every run. WebKit takes ~14 minutes. Cache ~/.cache/ms-playwright keyed on the Playwright version and browser name so subsequent runs only install system apt deps.
ef8ea73 to
bc18289
Compare
There was a problem hiding this comment.
Pull request overview
This PR speeds up Playwright CI runs by caching downloaded browser binaries between workflow runs, and adjusts installation steps to avoid redundant downloads on cache hits.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Changes:
- Add an
actions/cachestep for~/.cache/ms-playwright, keyed by Playwright version and the matrix browser. - On cache hit, skip browser download and only install OS dependencies via
playwright install-deps. - Bump
package.jsonversion to0.9.7-beta.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
package.json |
Bumps the package version (not mentioned in PR description). |
.github/workflows/ci.yml |
Caches Playwright browser binaries and changes install flow based on cache hit. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
The PR description only mentions caching Playwright binaries in CI, but this change bumps the package version from 0.9.5-beta to 0.9.7-beta. If the version bump isn’t intentional/release-related, it should be reverted or explained in the PR description to keep the change scoped and auditable.
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | ||
| with: | ||
| path: ~/.cache/ms-playwright | ||
| key: playwright-${{ matrix.browser }}-${{ steps.playwright-version.outputs.version }} |
There was a problem hiding this comment.
The cache key doesn’t include runner OS/arch, but the contents of ~/.cache/ms-playwright are OS-specific browser binaries. Including something like ${{ runner.os }} (and potentially ${{ runner.arch }}) in the key helps avoid restoring incompatible binaries if the job ever runs on a different runner image or OS.
| key: playwright-${{ matrix.browser }}-${{ steps.playwright-version.outputs.version }} | |
| key: playwright-${{ runner.os }}-${{ runner.arch }}-${{ matrix.browser }}-${{ steps.playwright-version.outputs.version }} |
Summary
~/.cache/ms-playwrightin the browser-test job, keyed on Playwright version and browser nameplaywright install-deps), which should cut ~14 minutes off WebKit runs