docs(ci): cache Playwright browsers in the GitHub Actions web workflow

Merged
KA
1mo ago
+19-1

What and why

  • The GitHub Actions web workflow in docs/ci/github-actions.mdx and its copy in skills/e2e/references/running.md now cache ~/.cache/ms-playwright, keyed on the runner OS, CPU architecture, and pnpm-lock.yaml.
  • On a cache hit, pnpm exec e2e-web install chromium --with-deps finds the browsers and downloads nothing; --with-deps still installs the system libraries. The lockfile pins @e2e-dev/web and its Playwright, so a version bump changes the key and downloads fresh browsers. runner.arch is 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 e2e patch changeset ships the skill change, since the package bundles skills/e2e/.
  • This follows @kdy1's CI speedups for this repo (#1530, #1569) in a form a user can copy. --only-shell is left out because e2e-web install accepts 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 ran pnpm exec e2e-web install chromium from apps/testbed twice against an empty PLAYWRIGHT_BROWSERS_PATH, the second time standing in for a restored cache:
RunDownloadsTime
empty cacheffmpeg, Chromium, headless shell20.3 s
cache presentnone0.2 s
  • pnpm docs:check and pnpm plugins:check pass.
  • Not run on GitHub Actions; the step is the stock actions/cache usage at the SHA the mobile workflow on this page already pins.