Skip to content

Commit 9c092ca

Browse files
ci: enable Hub-Client E2E Tests workflow
The workflow had never actually run on a runner — every push to main since it was added queued for the 24-hour GitHub Actions maximum and was cancelled because `runs-on: ubuntu-latest-8x` isn't a runner label this repo can request. Switching to `ubuntu-latest` unblocked everything else; from there the workflow itself needed several layers of fixes to actually pass: - Runner label: ubuntu-latest-8x → ubuntu-latest. - Build order: build the WASM module before the TypeScript packages, since hub-client's vite build imports the WASM JS glue. - WASM tooling: install wasm-bindgen-cli pinned to the version in Cargo.lock, and add the rust-src component (required by -Zbuild-std=std,panic_unwind in the wasm-quarto-hub-client crate's .cargo/config.toml). - Nightly pin: latest nightly rustc SIGSEGVs when compiling tokio for wasm32-unknown-unknown under -Zbuild-std. Pin nightly-2026-05-07 via the workflow's RUSTUP_TOOLCHAIN env var so rust-toolchain.toml stays as floating "nightly" for local developers. - dtolnay/rust-toolchain action: dated nightlies need @master with a toolchain input, not @nightly-YYYY-MM-DD as a ref. - TypeScript build scoping: only build ts-packages + hub-client. The q2-demos workspaces fail their vite build (vite can't resolve an absolute import in the wasm-bindgen output) and trace-viewer is out of scope. Tracked as bd-1jnb. - Pre-build the hub binary: globalSetup launches it with `cargo run --bin hub` and waits 120s for "Hub server listening" — on a cold runner the cargo compile exceeded that. - Baseline-commit step: switch the broken `**` glob to `find ... -name '*-snapshots' -exec git add -f {} +` (bash globstar isn't enabled by default; visual specs sit directly under hub-client/e2e/, not one directory deeper) and grant `contents: write` so the default GITHUB_TOKEN can push the auto-generated baselines back to the branch. - Add a `pull_request` trigger with the same path filter as `push`, so PRs that touch hub-client or the workflow file have to prove themselves green before merging.
1 parent 422c3c1 commit 9c092ca

1 file changed

Lines changed: 53 additions & 8 deletions

File tree

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

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
paths:
77
- 'hub-client/**'
88
- '.github/workflows/hub-client-e2e.yml'
9+
pull_request:
10+
paths:
11+
- 'hub-client/**'
12+
- '.github/workflows/hub-client-e2e.yml'
913
workflow_dispatch:
1014
inputs:
1115
recreate-all-snapshots:
@@ -15,10 +19,21 @@ on:
1519

1620
jobs:
1721
e2e-tests:
18-
runs-on: ubuntu-latest-8x
22+
runs-on: ubuntu-latest
1923
name: Hub-Client E2E Tests
2024
if: github.repository == 'quarto-dev/q2'
2125

26+
# Needed for the "Commit new baselines" step to push back to the
27+
# workflow branch. Default GITHUB_TOKEN is read-only.
28+
permissions:
29+
contents: write
30+
31+
# Pin nightly via env so we don't have to edit rust-toolchain.toml
32+
# (which devs may override locally). Latest nightly currently crashes
33+
# rustc with SIGSEGV when compiling tokio under -Zbuild-std for wasm32.
34+
env:
35+
RUSTUP_TOOLCHAIN: nightly-2026-05-07
36+
2237
steps:
2338
- name: Checkout Repo
2439
uses: actions/checkout@v6
@@ -34,9 +49,11 @@ jobs:
3449
3550
# Rust toolchain for WASM build
3651
- name: Set up Rust nightly
37-
uses: dtolnay/rust-toolchain@nightly
52+
uses: dtolnay/rust-toolchain@master
3853
with:
54+
toolchain: nightly-2026-05-07
3955
targets: wasm32-unknown-unknown
56+
components: rust-src
4057

4158
- name: Set up Clang
4259
uses: egor-tensin/setup-clang@v2
@@ -51,6 +68,14 @@ jobs:
5168
- name: Install wasm-pack
5269
run: cargo install wasm-pack
5370

71+
# build-wasm.js verifies wasm-bindgen CLI matches the version
72+
# pinned in Cargo.lock; install that exact version.
73+
- name: Install wasm-bindgen-cli
74+
run: |
75+
VERSION=$(awk '/^name = "wasm-bindgen"$/{getline; gsub(/version = |"/, ""); print; exit}' Cargo.lock)
76+
echo "Installing wasm-bindgen-cli $VERSION"
77+
cargo install -f wasm-bindgen-cli --version "$VERSION"
78+
5479
# tree-sitter for grammar builds
5580
- name: Set up tree-sitter CLI
5681
run: |
@@ -69,15 +94,32 @@ jobs:
6994
- name: Install npm dependencies
7095
run: npm ci
7196

72-
- name: Build TypeScript packages
73-
run: npm run build
74-
75-
# Build WASM module
97+
# WASM artifacts must exist before any package's `vite build` runs
98+
# (hub-client and q2-demos/* all import the WASM module).
7699
- name: Build WASM
77100
run: |
78101
cd hub-client
79102
npm run build:wasm
80103
104+
# Build only the workspaces the e2e tests actually exercise.
105+
# q2-demos/* currently fail their vite build (they import an
106+
# absolute path "/src/wasm-js-bridge/cache.js" that only exists
107+
# in hub-client/), and trace-viewer is not under test here.
108+
- name: Build TypeScript packages (ts-packages + hub-client)
109+
run: |
110+
for pkg in ts-packages/*/; do
111+
if [ -f "$pkg/package.json" ]; then
112+
npm run build --workspace "$pkg" --if-present
113+
fi
114+
done
115+
npm run build --workspace hub-client --if-present
116+
117+
# globalSetup launches the hub via `cargo run --bin hub` with a 120s
118+
# readiness timeout. On a cold CI runner the compile alone exceeds
119+
# that, so pre-build it here.
120+
- name: Pre-build hub binary
121+
run: cargo build --bin hub
122+
81123
# Install Playwright browsers
82124
- name: Install Playwright
83125
run: |
@@ -112,13 +154,16 @@ jobs:
112154
cd hub-client
113155
npx playwright test --config playwright.visual.config.ts --update-snapshots=missing
114156
115-
# If retry passed (only missing baselines), commit them back
157+
# If retry passed (only missing baselines), commit them back.
158+
# Use `find` instead of a `**` glob — bash globstar isn't enabled
159+
# by default and visual specs sit directly under hub-client/e2e/,
160+
# not one directory deeper.
116161
- name: Commit new baselines
117162
if: steps.visual.outcome == 'failure' && steps.visual-retry.outcome == 'success'
118163
run: |
119164
git config user.name "github-actions[bot]"
120165
git config user.email "github-actions[bot]@users.noreply.github.com"
121-
git add -f hub-client/e2e/**/*-snapshots/
166+
find hub-client/e2e -type d -name '*-snapshots' -exec git add -f {} +
122167
git diff --cached --quiet || git commit -m "Add missing Playwright visual regression baselines"
123168
git push
124169

0 commit comments

Comments
 (0)