Skip to content

Cache Playwright browsers and bound install timeout in CI#14415

Merged
cderv merged 2 commits intomainfrom
ci/playwright-install-resilience
Apr 23, 2026
Merged

Cache Playwright browsers and bound install timeout in CI#14415
cderv merged 2 commits intomainfrom
ci/playwright-install-resilience

Conversation

@cderv
Copy link
Copy Markdown
Member

@cderv cderv commented Apr 23, 2026

Recent CI runs showed the "Install Playwright Browsers" step hanging for 2+ hours on a subset of ubuntu-latest runners while sibling runners in the same workflow run finished the same step in ~40s. Since the step has no timeout, a stuck runner burns until GitHub's 6h job cap and blocks the smoke-test matrix.

Changes

  • Set PLAYWRIGHT_BROWSERS_PATH at job level to pin the browsers install location to a single path under github.workspace that resolves identically on Linux, Windows, and macOS. Install and test steps inherit the env, so they agree on the location.
  • Cache that path via actions/cache@v5, keyed on the resolved Playwright version (read from the installed @playwright/test package.json via node -p, not from the lockfile — current lockfile is stale).
  • Add timeout-minutes: 10 on the install step so a hung runner fails fast.
  • Keep npx playwright install --with-deps as-is per upstream Playwright guidance ([BUG] How to cache playwright OS binaries in github actions? microsoft/playwright#20603).

Verification

  • First run on this PR: cache-miss path — install completes in ~1 min as today.
  • Second run (empty commit): cache-hit path — install drops to ~30s, browser download skipped.

Non-goals

  • apt dep caching: upstream doesn't recommend it and the observed failure looks infra-transient rather than apt-slow.
  • Retry logic: deferred; revisit if cache + timeout alone is insufficient.
  • Fixing the stale tests/integration/playwright/package-lock.json (1.47.0 pinned while package.json specifies ^1.59.1). Tangential cleanup.

Install Playwright Browsers step in test-smokes.yml currently has no
timeout and re-downloads browser binaries on every run. A recent CI run
showed three ubuntu buckets stuck for 2+ hours on this step while
another bucket finished the same step in 41 seconds on a sibling
runner — the failure mode looks like transient runner/network hangs
rather than slow installs.

Set PLAYWRIGHT_BROWSERS_PATH at job level to pin the browsers install
location to a path under github.workspace that is identical across
Linux, Windows, and macOS. This lets a single actions/cache entry
restore browsers on any runner OS without the default-per-OS path
variance, and ensures install + test steps agree on the location.

Cache is keyed on the resolved Playwright version (read via node -p
on the installed @playwright/test package.json so the key tracks what
npm actually resolved, not the stale lockfile). Keep --with-deps as-is
per upstream guidance (microsoft/playwright#20603). Add
timeout-minutes: 10 so a stuck runner fails fast instead of blocking
the matrix until the 6h job cap.
@cderv cderv marked this pull request as ready for review April 23, 2026 12:51
@cderv cderv merged commit b8468bf into main Apr 23, 2026
51 checks passed
@cderv cderv deleted the ci/playwright-install-resilience branch April 23, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant