Skip to content

Commit 212bc89

Browse files
committed
Cache Playwright browsers and bound install timeout in CI
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.
1 parent 2b025d5 commit 212bc89

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

.github/workflows/test-smokes.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858
- os: windows-latest
5959
time-test: true
6060
runs-on: ${{ matrix.os }}
61+
env:
62+
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/ms-playwright-browsers
6163
steps:
6264
- name: Checkout Repo
6365
uses: actions/checkout@v6
@@ -98,8 +100,26 @@ jobs:
98100
working-directory: ./tests/integration/playwright
99101
shell: bash
100102

103+
- name: Get Playwright version
104+
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
105+
run: |
106+
VERSION=$(node -p "require('@playwright/test/package.json').version")
107+
echo "PLAYWRIGHT_VERSION=$VERSION" >> "$GITHUB_ENV"
108+
working-directory: ./tests/integration/playwright
109+
shell: bash
110+
111+
- name: Cache Playwright browsers
112+
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
113+
uses: actions/cache@v5
114+
with:
115+
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
116+
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
117+
restore-keys: |
118+
${{ runner.os }}-playwright-
119+
101120
- name: Install Playwright Browsers
102121
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
122+
timeout-minutes: 10
103123
run: npx playwright install --with-deps
104124
working-directory: ./tests/integration/playwright
105125

0 commit comments

Comments
 (0)