Skip to content

Merge pull request #583 from Hello-QM/ops/encrypt-release-secrets-202… #1284

Merge pull request #583 from Hello-QM/ops/encrypt-release-secrets-202…

Merge pull request #583 from Hello-QM/ops/encrypt-release-secrets-202… #1284

Workflow file for this run

name: Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
release:
types: [published]
env:
CARGO_NET_RETRY: "10"
CARGO_HTTP_MULTIPLEXING: "false"
# Threaded-ferrox nightly pin (read by the dtolnay step AND build-wasm.mjs).
# Bump only after `pnpm build:wasm && pnpm verify:wasm` passes on the new
# nightly; keep the pin identical across all workflows that define it.
CATGO_WASM_NIGHTLY_TOOLCHAIN: "nightly-2026-07-16"
jobs:
unit:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Setup uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
version: '0.11.16'
# Nightly (with rust-src) builds the THREADED ferrox artifact — std is
# rebuilt with atomics via -Z build-std. Installed before stable so
# stable stays the default toolchain for everything else. Pinned (not
# floating @nightly) via CATGO_WASM_NIGHTLY_TOOLCHAIN — see env above.
- name: Setup Rust nightly (threaded ferrox WASM)
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.CATGO_WASM_NIGHTLY_TOOLCHAIN }}
components: rust-src
targets: wasm32-unknown-unknown
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install dependencies
run: pnpm install
- name: Verify Node archive test tooling
run: |
uv --version
pnpm exec vsce --version
- name: Generate SvelteKit tsconfig + ambient types
run: pnpm exec svelte-kit sync
# Single canonical entry point for ALL wasm builds (design §8.3): it
# builds ferrox twice with explicit feature sets (wasm-scalar /
# wasm-threaded). Never invoke wasm-pack directly here — `--features
# wasm` without --no-default-features compiles default Rayon without a
# thread pool, which deadlocks in the browser.
- name: Build WASM extensions
run: pnpm build:wasm
- name: Verify WASM artifacts (scalar + threaded ferrox)
run: node scripts/verify-wasm-artifacts.mjs
- name: Build documentation chunks
run: pnpm run build:doc-chunks
- name: Run Node script tests
run: pnpm test:node
- name: Run unit tests
run: pnpm exec vitest run
- name: Run VSCode extension tests
working-directory: extensions/vscode
run: pnpm exec vitest run
- name: Typecheck VSCode extension
working-directory: extensions/vscode
run: pnpm exec tsc --noEmit
e2e:
runs-on: ubuntu-latest
# Run inside Playwright's official image, which ships the browsers
# preinstalled at /ms-playwright. The chromium download from
# cdn.playwright.dev systematically stalled ~18min on the runner and tripped
# the job backstop before the tests ran; the image removes that download
# entirely. Keep the tag in sync with @playwright/test in package.json.
container:
image: mcr.microsoft.com/playwright:v1.58.0-noble
continue-on-error: true
# Hard backstop: e2e is non-gating (continue-on-error) and has historically
# hung on the dev-server webServer, running to GitHub's 6h job cap. Bound it.
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
# Nightly (with rust-src) builds the THREADED ferrox artifact; stable
# installed second so it stays the default toolchain. Pinned via
# CATGO_WASM_NIGHTLY_TOOLCHAIN — see env above.
- name: Setup Rust nightly (threaded ferrox WASM)
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.CATGO_WASM_NIGHTLY_TOOLCHAIN }}
components: rust-src
targets: wasm32-unknown-unknown
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# The Playwright image is minimal and lacks a C toolchain. Native deps
# (node-pty) need node-gyp -> make/g++/python3 to build during install.
- name: Install build toolchain for native modules
run: apt-get update && apt-get install -y --no-install-recommends build-essential python3
- name: Install dependencies
run: pnpm install
- name: Generate SvelteKit tsconfig + ambient types
run: pnpm exec svelte-kit sync
# Canonical wasm entry point (design §8.3): builds ferrox scalar +
# threaded plus chgdiff + catrender. Prebuilding everything here also
# keeps predev.mjs (`--if-missing`) a no-op, so the e2e dev server
# starts before Playwright connects (page.goto → ERR_CONNECTION_REFUSED
# otherwise). Never invoke wasm-pack directly here.
- name: Build WASM extensions
run: pnpm build:wasm
- name: Build documentation chunks
run: pnpm run build:doc-chunks
# Browsers are preinstalled in the container image, so no download step.
# No step-level continue-on-error: the job-level one already keeps e2e
# non-gating, and the step must show a real X when tests fail (#310 —
# the double continue-on-error painted a failing suite green).
- name: Run e2e tests
# playwright.config starts the dev server with PORT=3005, but the smoke
# test defaults its target URL to :3186 (the local dev port). Point it at
# the server this job actually started, else page.goto → ERR_CONNECTION_REFUSED.
env:
CATGO_E2E_URL: http://localhost:3005
run: npx playwright test