Skip to content

Commit a60a30c

Browse files
committed
ci(e2e): run Playwright suite on macOS alongside Linux
macOS is the primary shipped platform but e2e only ran on Linux, so a whole class of platform/path bugs went uncaught in CI. The afterPack Linux-vs-macOS executable-name divergence is the canonical example: mac uses productFilename, Linux uses executableName, and only running the suite on both surfaces that kind of drift. Add a fail-fast:false os matrix (ubuntu-latest, macos-latest). The Linux-only steps stay gated so the ubuntu leg is byte-for-byte the same work as before: the Electron-binary unzip workaround (linux-x64 zip, dist/electron) and npx playwright install-deps are guarded with if: matrix.os == 'ubuntu-latest', and xvfb-run wraps the suite only when RUNNER_OS is Linux. macOS extracts dist/Electron.app via the normal postinstall and has a real display, so it needs neither. The venv provisioning and JLAB_TEST_PYTHON_PATH work unchanged on both. Artifacts are named per-OS so the two legs do not clobber each other. Note: AI-assisted (Claude Code). Manually verified: yaml parse (python yaml.safe_load) + that the ubuntu leg is unchanged (same steps, same commands, gates only add macOS); macOS leg verified by reading, not run (cannot run macOS CI locally).
1 parent 4f62f36 commit a60a30c

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ concurrency:
1515

1616
jobs:
1717
e2e:
18-
name: 'Playwright (Linux)'
19-
runs-on: ubuntu-latest
18+
name: 'Playwright (${{ matrix.os }})'
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest, macos-latest]
23+
runs-on: ${{ matrix.os }}
2024
# Bound the job so a stuck Electron launch/close fails fast instead of
2125
# tying up a runner; this suite specifically guards shutdown hangs.
2226
timeout-minutes: 15
@@ -37,8 +41,11 @@ jobs:
3741
# binary on this runner even though the downloaded zip is complete and
3842
# valid, so launch fails with "Electron failed to install correctly". Let
3943
# install.js fetch the zip into the cache, then extract it with the system
40-
# `unzip` and point path.txt at the binary.
44+
# `unzip` and point path.txt at the binary. Linux-only: the zip is the
45+
# linux-x64 build and the binary lives at dist/electron. On macOS the
46+
# postinstall extracts dist/Electron.app correctly and needs no workaround.
4147
- name: Install the Electron binary
48+
if: matrix.os == 'ubuntu-latest'
4249
run: |
4350
set -euo pipefail
4451
node node_modules/electron/install.js || true
@@ -51,8 +58,10 @@ jobs:
5158
- run: yarn build
5259
# Electron needs system libraries; xvfb provides a display on the headless
5360
# runner. The app launches up to four windows, so a real display beats
54-
# --headless here.
55-
- run: npx playwright install-deps
61+
# --headless here. Both are Linux-only: macOS runners have a display and do
62+
# not use this apt-based dependency installer.
63+
- if: matrix.os == 'ubuntu-latest'
64+
run: npx playwright install-deps
5665
# A minimal Python env with jupyterlab so the env-backed tests run (a venv
5766
# + pip is lighter than a full conda env for a smoke). The seeded
5867
# app-data.json points the app at this interpreter.
@@ -67,11 +76,19 @@ jobs:
6776
python3 -m venv "$RUNNER_TEMP/jlab-venv"
6877
"$RUNNER_TEMP/jlab-venv/bin/pip" install --quiet "jupyterlab==$ver"
6978
echo "JLAB_TEST_PYTHON_PATH=$RUNNER_TEMP/jlab-venv/bin/python" >> "$GITHUB_ENV"
70-
- run: xvfb-run -a yarn test:e2e
79+
# xvfb is Linux-only; on macOS the runner has a real display, so run the
80+
# suite directly. Same yarn test:e2e command on both legs.
81+
- name: Run the e2e suite
82+
run: |
83+
if [ "$RUNNER_OS" = "Linux" ]; then
84+
xvfb-run -a yarn test:e2e
85+
else
86+
yarn test:e2e
87+
fi
7188
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
7289
if: ${{ !cancelled() }}
7390
with:
74-
name: playwright-report
91+
name: playwright-report-${{ matrix.os }}
7592
path: |
7693
playwright-report/
7794
test-results/

0 commit comments

Comments
 (0)