open-standards/.github/workflows/wai-quantum-studio.yml
Transaction Science b3ac90034c Quantum Studio: one interface for the browser and the desktop app, on the job service's engine
wai/quantum-studio is an editor for OpenQASM programs with three places to run them: this browser (the engine in WebAssembly, in a worker), this computer (the engine built natively, in the desktop app), and the job service. Each returns the same job, and the Studio shows it the same way and checks its receipt where it runs. The same request and seed give the same counts in every place.

- The editor highlights OpenQASM, completes the standard gates and the program's own registers, marks the engine's diagnostics on their lines, and draws the circuit and shows the plan as the program is typed. Ctrl/⌘+Enter runs; Escape cancels.
- A result shows its method and why, its accuracy class, counts, expectation values, amplitudes with probability and phase, and a receipt naming whose key signed it, checked on this device, which can be downloaded. The program and the history of runs are kept on the device; a link carries the program in its fragment.
- It takes the host's design tokens (tokens.css when it stands alone) and follows the light and dark schemes.
- test/studio.test.mjs runs it in a browser: lint, draw and plan; a run checked here; an error on its line; any angle; the service giving the counts run here, shot for shot; Ctrl+Enter; the program and the history surviving a reload; no sideways scroll at a phone's width.

wai/wai-quantum-desktop is the app: the Studio's build around the engine natively. Each job runs in a process of its own (the binary as `worker`), so Cancel ends it and a large one cannot take the app with it. The worker plans and runs, and the app seals the answer with this user's key, the command line's. Jobs and programs are saved under ~/Documents/Quantum Studio/. `check` runs a Bell pair through the worker, sealed and verified, with no window.

engine::job splits into plan_and_run and seal (run is both), for hosts that run a job away from their key. wai-quantum-cli gains a library target for its key module, shared with the app.

.github/workflows/wai-quantum-studio.yml builds the engine's browser package, builds the Studio and runs its test, and on macOS runs the app's tests, clippy and check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 547d6db753)
2026-10-20 17:34:16 -04:00

137 lines
5.1 KiB
YAML

name: wai-quantum studio and desktop
# Quantum Studio (wai/quantum-studio), the interface for the browser and the
# desktop, and the desktop app around it (wai/wai-quantum-desktop):
# - the Studio built against the engine's browser package (wai-web, feature
# quantum_engine) and run in a browser by test/studio.test.mjs: linted, drawn and
# planned as it is typed, run here with its receipt checked here, an error marked
# on its line, any angle on the state vector, Ctrl+Enter, and the program and the
# history kept across a reload; nothing scrolls sideways at a phone's width;
# - the desktop app's tests and clippy with warnings as errors, and `check`: a job
# run in the app's worker process, sealed in the app with a key that never leaves
# it, and verified, with no window.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [main]
paths:
- 'wai/quantum-studio/**'
- 'wai/wai-quantum-desktop/**'
- 'wai/wai-quantum/**'
- 'wai/wai-quantum-cli/**'
- 'wai/wai-web/**'
- 'wai/wai-rs/**'
- 'rust-toolchain.toml'
- '.github/workflows/wai-quantum-studio.yml'
pull_request:
paths:
- 'wai/quantum-studio/**'
- 'wai/wai-quantum-desktop/**'
- 'wai/wai-quantum/**'
- 'wai/wai-quantum-cli/**'
- 'wai/wai-web/**'
- 'wai/wai-rs/**'
- 'rust-toolchain.toml'
- '.github/workflows/wai-quantum-studio.yml'
jobs:
relevant:
name: does this change touch it
runs-on: linux-arm64
outputs:
run: ${{ steps.gate.outputs.run }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- id: gate
run: |
set -euo pipefail
r=$(python3 scripts/pr-touches-paths.py .github/workflows/wai-quantum-studio.yml \
"${{ github.event.pull_request.base.sha }}" \
"${{ github.event.pull_request.head.sha }}")
echo "this change touches the studio or the desktop app: $r"
echo "run=$r" >> "$GITHUB_OUTPUT"
studio:
name: studio · browser
needs: relevant
if: needs.relevant.outputs.run == 'true'
runs-on: linux
timeout-minutes: 60
steps:
- uses: actions/checkout@v5
- name: Install Rust 1.98.0 with the wasm32 target
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
command -v rustup >/dev/null 2>&1 || \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.98.0
rustup toolchain install 1.98.0 --profile minimal
rustup default 1.98.0
rustup target add wasm32-unknown-unknown
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
# Pinned to the wasm-bindgen version in wai-web/Cargo.lock.
- name: wasm-bindgen CLI 0.2.127
shell: bash
run: cargo install --locked wasm-bindgen-cli --version 0.2.127
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: The engine's browser package
shell: bash
working-directory: wai/wai-web
run: |
set -euo pipefail
cargo build --locked --release --target wasm32-unknown-unknown --features quantum_engine
wasm-bindgen --target web --out-dir "$RUNNER_TEMP/pkg" --out-name wai_quantum_ide \
target/wasm32-unknown-unknown/release/wai_web.wasm
- name: Build the Studio and run it in a browser
shell: bash
working-directory: wai/quantum-studio
env:
WAI_E2E_CHANNEL: ''
STUDIO_SKIP_SERVICE: '1'
run: |
set -euo pipefail
npm ci --no-audit --no-fund
npx playwright install --with-deps chromium
node build.mjs --pkg "$RUNNER_TEMP/pkg"
node test/studio.test.mjs
desktop:
name: desktop app · macos
needs: relevant
if: needs.relevant.outputs.run == 'true'
runs-on: macos
timeout-minutes: 90
steps:
- uses: actions/checkout@v5
# launchd's PATH omits cargo and node on the macOS host runner.
- name: Put cargo and node on PATH
shell: bash
run: |
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
echo "/opt/homebrew/bin" >> "$GITHUB_PATH"
# The app embeds the Studio's build, so it is built first.
- name: Build the Studio
shell: bash
working-directory: wai/quantum-studio
run: |
set -euo pipefail
npm ci --no-audit --no-fund
node build.mjs
- name: Tests, clippy, and a job through the worker with no window
shell: bash
working-directory: wai/wai-quantum-desktop
run: |
set -euo pipefail
nice -n 10 cargo test --locked --release 2>&1 | tee "$RUNNER_TEMP/test.log"
grep -qE '^test result: ok\. [1-9][0-9]* passed; 0 failed' "$RUNNER_TEMP/test.log" || { echo "::error::no test ran"; exit 1; }
nice -n 10 cargo clippy --locked --release --all-targets -- -D warnings
nice -n 10 cargo build --locked --release
./target/release/wai-quantum-desktop check