Repository navigation
ci: cache Playwright browsers for pull request browser tests - #343387
Conversation
b731e36 to
f324fcf
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
What changed in this PR
Adds a reusable GitHub composite action to cache Playwright browser binaries and wires it into PR browser-test workflows plus main-branch cache warming, reducing failures due to intermittent Playwright CDN download issues.
Changes:
- Introduces
.github/actions/restore-playwrightto restore/download/cache Playwright browsers under.build/ms-playwrightand setPLAYWRIGHT_BROWSERS_PATH. - Updates PR test workflows and cache-warming workflows to restore/warm the Playwright browser cache.
- Extends
detect-missing-cacheslogic/tests and updates documentation to account for the new Playwright cache.
| File | Description |
|---|---|
build/lib/test/detectMissingCaches.test.ts |
Updates cache-detection tests to include the new Playwright cache and runner.arch handling. |
.github/workflows/pr-win32-test.yml |
Restores Playwright browsers cache before installing browsers on Windows PR tests. |
.github/workflows/pr-node-modules.yml |
Warms Playwright browsers cache on main for Linux/macOS/Windows. |
.github/workflows/pr-linux-test.yml |
Restores Playwright browsers cache before installing browsers on Linux PR tests. |
.github/workflows/pr-darwin-test.yml |
Restores Playwright browsers cache before installing browsers on macOS PR tests. |
.github/workflows/node_modules_cache/README.md |
Documents that Playwright browsers are now part of the warmed caches. |
.github/workflows/component-fixtures.yml |
Restores/saves Playwright browsers cache for component fixtures workflows. |
.github/actions/restore-playwright/action.yml |
New composite action that prepares env, restores cache, downloads on miss (optional), and saves cache. |
.github/actions/detect-missing-caches/detect.ts |
Adds Playwright cache key computation to the cache-warming detection logic. |
Review effort: Lite
|
Cold and warm evidence on this PR, from
The temporary commit is gone from the branch. Both Copilot threads are addressed: the restore no longer depends on
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
5 open issues
The action mixesactions/cachemajor versions (restore@v6.1.0withsave@v5.1.0). Cache… · New The action mixesactions/cachemajor versions (restore@v6.1.0withsave@v5.1.0). Cache… · New If the lockfile does not containpackages['node_modules/playwright'](e.g., lockfile format… · New Both platform-specific steps share the same display name, which makes job logs harder to interpret… · New Both platform-specific steps share the same display name, which makes job logs harder to interpret… · New
2 resolved since last review
Review effort: Lite
|
Heads-up on file overlap, with no action needed now. Logan Ramos (@lramos15)'s sharding drafts (#343812 to #343816) and Michael Lively (@Yoyokrazy)'s #343094 also edit
|
|
Heads-up on overlap with Alexandru Dima (@alexdima)'s draft #344218 ("ci: report the PR test checks as
If both land as they are,
|
|
I've temporarily stacked this PR on Ladislau Szomoru (@lszomoru)'s #344400 (head
Once #344400 merges, I'll rebase onto
|
d1ced1a to
6eae9d4
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Cold and warm cache behavior across Linux, macOS, and Windows still needs CI confirmation.
No open issues 🎉
5 resolved since last review
The action mixesactions/cachemajor versions (restore@v6.1.0withsave@v5.1.0). Cache… The action mixesactions/cachemajor versions (restore@v6.1.0withsave@v5.1.0). Cache… If the lockfile does not containpackages['node_modules/playwright'](e.g., lockfile format… Both platform-specific steps share the same display name, which makes job logs harder to interpret… Both platform-specific steps share the same display name, which makes job logs harder to interpret…
Review effort: Balanced
6eae9d4 to
17f6350
Compare
|
Ladislau Szomoru (@lszomoru), since you own the GitHub Actions PR workflows: this PR caches Playwright browsers in PR CI, so the browser jobs stop depending on the Playwright CDN. It adds a
|
a2162ac to
8477a41
Compare
8477a41 to
897e52d
Compare
Browser tests download Playwright's browsers from its CDN on every run. In the last 14 days 4 GitHub jobs failed only because that download did: `ERR_TLS_CERT_ALTNAME_INVALID` from `cdn.playwright.dev` and DNS misses on its mirror. Add `.github/actions/restore-playwright`, modeled on `restore-wsl-installer`. It points PLAYWRIGHT_BROWSERS_PATH at `.build/ms-playwright` and restores the browsers of the pinned Playwright version from a cache keyed on OS, arch, version and the install arguments. The existing install steps stay unchanged: on a hit they find the browsers and download nothing, on a miss they download as before. `pr-node-modules.yml` warms the caches on main for the Linux, macOS and Windows jobs, and `detect-missing-caches` computes their keys. `component-fixtures.yml` saves its own cache on pushes to main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Component fixture runs on main save the cache and then install the browsers, so they need a restore on a hit instead of a lookup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The PR test workflows now pick the test runner through job-level env (BROWSER_TESTS) rather than the browser_tests input, so restore the browsers under the same condition as the Install Playwright step that uses them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The pnpm migration (#344791) removed the root package-lock.json. Read the version of the root @playwright/test dependency from the pnpm-lock.yaml importer instead, in both the restore action and the missing-cache detection, so their cache keys still match. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
897e52d to
b43fb3f
Compare
…s caches #345839 moved the native build targets from the .npmrc files to the nativeBuild field of package.json, so a job now compares the inputs of computeNodeModulesBaseCacheKey (#345840) between its commit and the commit of a workspace image: the salt, the pnpmfiles, the Node.js versions, the pnpm settings of every install root, and the nativeBuild and packageManager fields of package.json, which the restore reads in the same GraphQL request. workspaceImage.test.ts derives these inputs from the base key, so that they can't drift apart. - The producer also builds the images when package.json, remote/package.json or extensions/copilot/.nvmrc change. - The test jobs that use an image skip the Playwright browsers cache (#343387), as the image holds the browsers. - The Electron stamp no longer hashes the deleted .npmrc. - The temporary validation runs every test job. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>



Caches Playwright's browsers for the GitHub browser-test jobs, so a CDN incident no longer fails them. This is the GitHub half of B11. An ADO PR follows once #343325 lands.
Why
Over the last 14 days, out of 15,508 GitHub workflow runs, 4 jobs failed only in a Playwright browser-download step. That's 2 in
component-fixturestoday withERR_TLS_CERT_ALTNAME_INVALIDfromcdn.playwright.dev, 1 inmonaco-editortoday, and 1 inpr.yml(macOS) on Oct 13. The existing 3-attempt retry loops can't outlast a CDN problem that lasts minutes.What
.github/actions/restore-playwright, modeled onrestore-wsl-installer.PLAYWRIGHT_BROWSERS_PATHto.build/ms-playwrightfor the rest of the job.runner.os,runner.arch, the pinnedplaywrightversion frompackage-lock.json, and the install arguments.save-cache: 'true', it downloads the browsers withnpx playwright@<version> install …on a miss and saves them, the same way the other warm-on-main caches work.pr-{linux,darwin,win32}-test.ymlrestore it right before the existing install step, which is unchanged. On a hit,playwright installfinds the browsers and downloads nothing. On a miss, it downloads exactly as today, retry loop included.pr-node-modules.ymlwarms the cache on main in the Linux, macOS and Windows jobs. The step iscontinue-on-error, like the WSL one.detect-missing-cachescomputes these keys, anddetectMissingCaches.test.tschecks that the jobs, keys, versions and the action stay in sync.component-fixtures.ymlrestores in both jobs. It saves on pushes to main, where that workflow already runs. The fixture-tests job uses its owntest/componentFixtures/playwright/package-lock.json.monaco-editor.ymlis left out. It runs only on pull requests and installs every browser, and it had one hit in 14 days.Validation
node --test build/lib/test/detectMissingCaches.test.tspasses 4/4 with the new cache.1.61.1and sets keys such asplaywright-v1-macOS-ARM64-1.61.1-only-shell-chromium-webkit.tsc -p buildreports nothing in the touched files.Overlap with in-flight CI changes (rebased Nov 2, on pnpm)
mainafter the pnpm 12 migration (Engineering - move to pnpm12 #344791). The rebase applied cleanly.main's workflows already runpnpm exec playwright install.package-lock.jsonno longer exists.restore-playwrightanddetect-missing-cachesnow read the version of the root importer's@playwright/testfrompnpm-lock.yaml(1.61.1). The action's input is nowpnpm-lock(defaultpnpm-lock.yaml), andcomponent-fixtures.ymlpassestest/componentFixtures/playwright/pnpm-lock.yaml. Both lockfiles resolve to 1.61.1, and the 6 detect-missing-caches tests pass.-macos-5-core-0) and Browser (-macos-5-core-2) with the same key as the-macos-5-core-0cache warmer.