Skip to content

Commit 5f16330

Browse files
ci(hub-client-e2e): cache + timeout/retry Playwright browser install
The chromium download (~175 MB from cdn.playwright.dev, Azure-fronted) intermittently stalls mid-transfer on the path from the Azure-hosted GitHub runners. Playwright's downloader has no stall-timeout, so it hangs on the dead connection until the 6h job cap cancels the run. Every E2E run since ~2026-05-27 died this way. Fix: - Cache ~/.cache/ms-playwright keyed on package-lock.json so most runs skip the download; a Playwright bump invalidates the cache. - Split install-deps (apt, no CDN) from the browser download. - Wrap the browser download in timeout 240 + 5x retry so a stalled connection is killed in ~4 min and retried instead of burning 6h. Browser (full chromium) and Playwright version unchanged, so visual regression baselines are unaffected.
1 parent 4b07abe commit 5f16330

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

.github/workflows/hub-client-e2e.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,46 @@ jobs:
127127
- name: Pre-build hub binary
128128
run: cargo build --bin hub
129129

130-
# Install Playwright browsers
130+
# Cache the downloaded browser binaries across runs. Keyed on the
131+
# lockfile so a Playwright version bump invalidates the cache and
132+
# re-downloads; otherwise we skip the 175 MB chromium download
133+
# entirely.
134+
- name: Cache Playwright browsers
135+
uses: actions/cache@v4
136+
with:
137+
path: ~/.cache/ms-playwright
138+
key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
139+
140+
# Install Playwright browsers.
141+
#
142+
# The browser download (chromium ~175 MB) comes from
143+
# cdn.playwright.dev, which is fronted by Azure Front Door. The
144+
# connection from the (also-Azure) GitHub runners to that CDN
145+
# intermittently *stalls* mid-download — Playwright's downloader has
146+
# no stall-timeout, so it sits on the dead connection until the 6h
147+
# job cap kills the whole run (bd / Carlos report, 2026-05).
148+
#
149+
# Defend against that two ways: (1) OS deps go through apt
150+
# (`install-deps`, no CDN) separately from the browser download, and
151+
# (2) the browser download is wrapped in `timeout` + retry so a
152+
# stalled connection is killed in ~4 min and retried — retries
153+
# usually land on a healthy CDN edge. When the cache above hits,
154+
# `playwright install` verifies the existing binaries and returns
155+
# almost immediately, so the retry loop is a no-op on the happy path.
131156
- name: Install Playwright
132157
run: |
133158
cd hub-client
134-
npx playwright install --with-deps chromium
159+
npx playwright install-deps chromium
160+
for attempt in 1 2 3 4 5; do
161+
if timeout 240 npx playwright install chromium; then
162+
echo "Playwright browsers installed (attempt $attempt)"
163+
exit 0
164+
fi
165+
echo "::warning::Playwright browser install attempt $attempt stalled or failed; retrying in 10s"
166+
sleep 10
167+
done
168+
echo "::error::Playwright browser install failed after 5 attempts"
169+
exit 1
135170
136171
# Delete all snapshots if recreating from scratch
137172
- name: Delete all snapshots (recreate mode)

0 commit comments

Comments
 (0)