Repository navigation
[ci] Chore: cache Playwright's apt packages and skip WebKit deps on Linux - #9085
Merged
etrepum merged 2 commits intoAug 21, 2026
Merged
Conversation
…inux
## Description
Every Linux CI job runs `pnpm exec playwright install-deps` through
`.github/actions/setup-playwright`, and that step downloads its apt packages
from scratch on every run. Two things make it more expensive than it needs to
be:
- It was invoked with no browser arguments, so it installed the dependency
closure for all three browsers. WebKit accounts for the large majority of
those packages, and WebKit is never launched on Linux in this repository —
`call-e2e-test.yml` guards it behind `os == 'macos-latest'`, the
`tests-extended.yml` browser matrix only pairs WebKit with macOS, and nothing
under `examples/` or `scripts/__tests__/integration` references it.
- Nothing was cached, so the same packages were fetched from the Ubuntu archive
on every job of every run.
This change:
- Adds a `browsers` input (default `chromium firefox`) that is passed to
`playwright install-deps`, so WebKit's dependency closure is no longer
downloaded on Linux. A Linux job that does need WebKit can opt back in.
- Redirects apt's archive directory to `${RUNNER_TEMP}/playwright-apt` via a
drop-in `/etc/apt/apt.conf.d` file and sets
`APT::Keep-Downloaded-Packages "true"`, then caches the resulting `*.deb`
files with `actions/cache`. Playwright shells out to a plain
`apt-get install`, so configuring apt globally is what lets its own
invocation pick the cache up. On a warm cache apt reports
`Need to get 0 B` and installs straight from disk.
The cache key covers the distro release, arch, Playwright version and browser
list, plus an ISO-week salt so the stored `.deb` files never drift more than a
week behind the archive index; `restore-keys` falls back to the previous week's
entry so a stale cache still avoids most of the download, and the refreshed set
is saved under the new key.
A prebuilt `mcr.microsoft.com/playwright` container was considered as an
alternative. It was not taken because it only helps the Linux jobs (macOS and
Windows still need the current path), it requires manually keeping the image tag
in sync with the `@playwright/test` version, and with the dependency set reduced
and cached there is little left for it to save.
## Test plan
Measured on an Ubuntu 24.04 container with `[email protected]`, matching
the `ubuntu-latest` runner image.
### Before
`install-deps` with no browser arguments resolves the full three-browser
closure:
$ node cli.js install-deps --dry-run
Missing system dependencies (184):
dictionaries-common
emacsen-common
glib-networking
...
Broken down by browser on the same pristine container:
$ node cli.js install-deps --dry-run chromium
All system dependencies are installed.
$ node cli.js install-deps --dry-run firefox
Missing system dependencies (33):
$ node cli.js install-deps --dry-run webkit
Missing system dependencies (184):
The WebKit-only remainder is 156 packages / 65.0 MB of downloads on top of the
49 packages / 37 MB that chromium + firefox pull in, so the old invocation
fetched roughly 102 MB per Linux job.
### After
`install-deps chromium firefox` populates the redirected archive directory:
$ printf 'Dir::Cache::archives "%s";\nAPT::Keep-Downloaded-Packages "true";\n' \
"$APT_CACHE_DIR" | sudo tee /etc/apt/apt.conf.d/99-playwright-deps-cache
$ node cli.js install-deps chromium firefox
...
Processing triggers for libc-bin (2.39-0ubuntu8.7) ...
real 0m24.852s
$ ls "$APT_CACHE_DIR"/*.deb | wc -l
49
$ du -sh "$APT_CACHE_DIR"
37M
With the archive directory populated (the warm-cache path), apt installs
without touching the network:
$ apt-get install --reinstall -y --no-install-recommends libavcodec60
Need to get 0 B/5851 kB of archives.
The composite action's own shell steps were exercised directly: the cache key
computation emits
dir=<RUNNER_TEMP>/playwright-apt
restore_key=playwright-apt-v1-ubuntu-24.04-X64-pw1.60.0-chromium+firefox-
key=playwright-apt-v1-ubuntu-24.04-X64-pw1.60.0-chromium+firefox-2026-34
and the `.deb` counting reports `deb_count=0` for an empty directory (so the
save step is skipped rather than failing on an empty glob) and `deb_count=49`
for the populated one.
The workflows themselves could not be exercised here — GitHub Actions does not
run in this environment, so the cache save/restore round trip and the macOS and
Windows paths (where the new steps are skipped by `runner.os == 'Linux'`) are
unverified until CI runs. `prettier --check` passes on the changed file.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
marked this pull request as ready for review
August 20, 2026 21:59
etrepum
requested review from
acywatson,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
August 20, 2026 21:59
zurfyx
approved these changes
Aug 21, 2026
unix-max
pushed a commit
to unix-max/lexical
that referenced
this pull request
Aug 28, 2026
…inux (meta#9085) Co-authored-by: Claude <[email protected]>
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Improve the CI performance of
setup-playwright(used in e2e and browser unit tests) by caching apt dependencies and installing only the dependencies for the browsers under test (chromium and firefox, explicitly not webkit)Test plan
A successful CI pair of runs is the test - the first run populated the cache and the next proves that the cache worked.