Skip to content

Commit 7af486c

Browse files
whitphxclaude
andauthored
ci: run e2e-browser inside Playwright Docker image (#2053)
* ci: cache Playwright browsers in e2e-browser job `playwright install` repeatedly hung post-download on GitHub Actions runners (Chromium zip finished in <1s, then ~15min of silence until the step timeout). Restoring `~/.cache/ms-playwright` from a yarn.lock-keyed cache makes the install step a no-op on warm runs and sidesteps the hang entirely. First run on a new lockfile still has to populate the cache, but subsequent shards/runs reuse it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci: run e2e-browser inside Playwright Docker image `yarn install:browsers` (i.e. `playwright install --with-deps`) repeatedly hung post-download on plain ubuntu-latest runners — the Chromium zip finished in <1s, then ~15min of total silence until the step timeout fired. An earlier attempt to cache `~/.cache/ms-playwright` didn't help because every shard starts cold simultaneously and `actions/cache` only saves on workflow success. Use the official `mcr.microsoft.com/playwright` image (the same approach e2e-react already uses via its `run-in-docker.sh`): browsers and system deps are pre-installed at /ms-playwright, so the `install:browsers` step becomes unnecessary and the flake disappears. The image tag must match `@playwright/test` in packages/browser/e2e-tests/package.json; bump alongside any Playwright upgrade. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci: set HOME=/root for Playwright tests in Docker Inside `mcr.microsoft.com/playwright` we run as root, but GH Actions overrides `\$HOME` to `/github/home` (owned by `pwuser`). Firefox refuses to launch under those conditions ("Running Nightly as root in a regular user's session is not supported"). Playwright surfaces the exact workaround in its error message: set `HOME=/root`. Chromium and webkit shards passed; only Firefox tests were affected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 992dda0 commit 7af486c

2 files changed

Lines changed: 27 additions & 7 deletions

File tree

.changeset/e2e-browser-docker.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
CI-only: run the e2e-browser Playwright job inside the official Playwright Docker image (`mcr.microsoft.com/playwright`) so the `yarn install:browsers` step is no longer needed. Sidesteps an intermittent post-download hang in Playwright's `install --with-deps` that had been timing out shards.

.github/workflows/e2e.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ jobs:
7676

7777
runs-on: ubuntu-latest
7878

79+
# `yarn install:browsers` (i.e. `playwright install --with-deps`)
80+
# repeatedly hung post-download on plain ubuntu-latest runners: the
81+
# Chromium zip finished in <1s, then ~15min of silence until the step
82+
# timeout fired. Running the job inside Playwright's official Docker
83+
# image — which ships browsers pre-installed at /ms-playwright with
84+
# all system deps already there — sidesteps that install step
85+
# entirely. (Same approach as e2e-react below.)
86+
#
87+
# Image tag must match `@playwright/test` in
88+
# packages/browser/e2e-tests/package.json — bump alongside any
89+
# Playwright upgrade.
90+
container:
91+
image: mcr.microsoft.com/playwright:v1.57.0
92+
options: --ipc=host # Recommended by Playwright for Chromium shared memory.
93+
7994
strategy:
8095
fail-fast: false
8196
matrix:
@@ -94,14 +109,10 @@ jobs:
94109
node-version-file: ${{ env.node-version-file }}
95110

96111
- name: Set up the e2e-tests environment
97-
# `yarn install` (registry) and `yarn install:browsers` (Playwright CDN)
98-
# have intermittently hung in GitHub Actions runners and burned the
99-
# whole 6h job timeout. Cap the step so a hang fails fast and the
100-
# shard can be rerun.
112+
# Cap as a safety net; browsers come from the container image,
113+
# so this is just `yarn install`.
101114
timeout-minutes: 15
102-
run: |
103-
yarn install
104-
yarn install:browsers
115+
run: yarn install
105116
working-directory: packages/browser/e2e-tests
106117

107118
- name: Build demos
@@ -125,6 +136,11 @@ jobs:
125136
working-directory: packages/browser/e2e-tests
126137
env:
127138
BUILD_DIR: ${{ runner.temp }}/artifacts/browser/package/build
139+
# Inside the Playwright container we run as root, but GH Actions
140+
# overrides $HOME to /github/home (owned by pwuser). Firefox
141+
# refuses to launch in that state; restore HOME=/root.
142+
# Playwright's own error message points at this exact fix.
143+
HOME: /root
128144

129145
- name: Upload blob report to GitHub Actions Artifacts
130146
if: ${{ !cancelled() }}

0 commit comments

Comments
 (0)