Add runtime capability introspection API #182
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [master, development] | |
| pull_request: | |
| branches: [master, development] | |
| workflow_call: | |
| permissions: | |
| contents: read | |
| jobs: | |
| msrv: | |
| name: MSRV (1.77) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@1.77 | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo check --workspace | |
| - run: cargo check --target wasm32-unknown-unknown -p webtau | |
| rust: | |
| name: Rust | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo test --workspace | |
| - run: cargo clippy --workspace -- -D warnings | |
| - name: Battlestation scenario smoke | |
| run: cargo test -p battlestation-core --lib --manifest-path examples/battlestation/src-tauri/Cargo.toml | |
| - name: Check WASM codegen (wasm32 target) | |
| run: | | |
| cargo check --target wasm32-unknown-unknown -p counter-commands --manifest-path examples/counter/src-tauri/Cargo.toml | |
| cargo check --target wasm32-unknown-unknown -p pong-commands --manifest-path examples/pong/src-tauri/Cargo.toml | |
| cargo check --target wasm32-unknown-unknown -p battlestation-commands --manifest-path examples/battlestation/src-tauri/Cargo.toml | |
| typescript: | |
| name: TypeScript | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.9 | |
| - run: bun install | |
| - name: Run package tests in isolated processes | |
| run: | | |
| shopt -s nullglob | |
| package_json_files=(packages/*/package.json) | |
| if [ ${#package_json_files[@]} -eq 0 ]; then | |
| echo "No package.json files found under packages/." | |
| exit 1 | |
| fi | |
| for package_json in "${package_json_files[@]}"; do | |
| package_dir="$(dirname "$package_json")" | |
| echo "::group::${package_dir}" | |
| (cd "$package_dir" && bun run test) | |
| echo "::endgroup::" | |
| done | |
| - name: Run create-gametau tests against built dist | |
| run: | | |
| cd packages/create-gametau | |
| bun run build | |
| bun run test | |
| - name: Build webtau types for example typecheck | |
| run: | | |
| cd packages/webtau | |
| bun run build | |
| - run: bunx tsc --noEmit -p packages/webtau/tsconfig.json | |
| - run: bunx tsc --noEmit -p packages/webtau-vite/tsconfig.json | |
| - run: bunx tsc --noEmit -p packages/create-gametau/tsconfig.json | |
| - run: bunx tsc --noEmit -p examples/electrobun-counter/tsconfig.json | |
| - run: bunx tsc --noEmit -p examples/battlestation/tsconfig.json | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.9 | |
| - run: bun install | |
| - run: bun run lint | |
| api-docs: | |
| name: API Docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.9 | |
| - run: bun install | |
| - name: Generate API docs (TypeDoc + rustdoc) | |
| run: bun run docs:api | |
| - name: Verify API docs were generated | |
| run: | | |
| test -d .api-docs | |
| test -f .api-docs/index.html | |
| echo "API docs directory verified." | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: api-docs | |
| path: .api-docs | |
| if-no-files-found: error | |
| include-hidden-files: true | |
| smoke: | |
| name: Scaffold & Build Smoke | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install wasm-pack (web build dependency) | |
| run: cargo install wasm-pack | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - name: Install workspace dependencies | |
| run: bun install | |
| - name: Build smoke dependency package (webtau) | |
| run: cd packages/webtau && bun run build | |
| - name: Build smoke dependency package (webtau-vite) | |
| run: cd packages/webtau-vite && bun run build | |
| - name: Pack smoke artifacts | |
| run: | | |
| mkdir -p packages/create-gametau/.pack-smoke | |
| cd packages/webtau | |
| tgz="$(npm pack --silent)" | |
| mv "$tgz" ../create-gametau/.pack-smoke/webtau.tgz | |
| cd ../webtau-vite | |
| tgz="$(npm pack --silent)" | |
| mv "$tgz" ../create-gametau/.pack-smoke/webtau-vite.tgz | |
| cd ../create-gametau | |
| tgz="$(npm pack --silent)" | |
| mv "$tgz" .pack-smoke/create-gametau.tgz | |
| tar -xzf .pack-smoke/create-gametau.tgz -C .pack-smoke | |
| - name: Scaffold smoke projects from packed create-gametau artifact | |
| run: | | |
| cd packages/create-gametau/.pack-smoke | |
| node package/dist/cli.js --version | |
| if node package/dist/cli.js smoke-bad --wat; then | |
| echo "Expected unknown option to fail" | |
| exit 1 | |
| fi | |
| node package/dist/cli.js smoke-game | |
| node package/dist/cli.js smokegame | |
| # Allow smoke builds to compile against the local workspace crate | |
| # before the new crates.io version is published. | |
| workspace_webtau="$GITHUB_WORKSPACE/crates/webtau" | |
| for project in smoke-game smokegame; do | |
| test -d "$project" | |
| test -f "$project/.gitignore" | |
| test ! -f "$project/gitignore" | |
| test ! -f "$project/.npmignore" | |
| # Force scaffold builds to consume the freshly packed local artifacts. | |
| (cd "$project" && npm pkg set dependencies.webtau="file:../webtau.tgz" devDependencies.webtau-vite="file:../webtau-vite.tgz") | |
| sed -i "s#^webtau = \".*\"#webtau = { path = \"${workspace_webtau}\" }#" "$project/src-tauri/commands/Cargo.toml" | |
| sed -i "s#^webtau = \".*\"#webtau = { path = \"${workspace_webtau}\" }#" "$project/src-tauri/wasm/Cargo.toml" | |
| done | |
| - name: Build scaffolded projects (web target) | |
| run: | | |
| cd packages/create-gametau/.pack-smoke | |
| for project in smoke-game smokegame; do | |
| echo "::group::${project}" | |
| ( | |
| cd "$project" | |
| bun install | |
| bun run build:web | |
| test -d dist | |
| test -f dist/index.html | |
| ) | |
| echo "::endgroup::" | |
| done | |
| - name: Verify webtau-vite fallback path without wasm-pack | |
| run: | | |
| cd packages/create-gametau/.pack-smoke/smoke-game | |
| # Ensure the initial web build produced reusable wasm-pack artifacts. | |
| test -d src/wasm | |
| ls src/wasm/*_bg.wasm >/dev/null | |
| ls src/wasm/*.js >/dev/null | |
| path_without_cargo="$(python3 - <<'PY' | |
| import os | |
| path_entries = os.environ["PATH"].split(":") | |
| filtered = [p for p in path_entries if not p.endswith("/.cargo/bin")] | |
| print(":".join(filtered)) | |
| PY | |
| )" | |
| fallback_log="$(mktemp)" | |
| env PATH="$path_without_cargo" bun run build:web 2>&1 | tee "$fallback_log" | |
| if [[ "$(cat "$fallback_log")" != *"Reusing existing WASM output"* ]]; then | |
| echo "Expected fallback warning was not emitted when wasm-pack was unavailable." | |
| exit 1 | |
| fi | |
| - name: Build battlestation example (web target) | |
| run: | | |
| cd examples/battlestation | |
| bun run build:web | |
| test -d dist | |
| test -f dist/index.html | |
| electrobun-smoke: | |
| name: Electrobun Hybrid + GPU Smoke | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install wasm-pack (web build dependency) | |
| run: cargo install wasm-pack | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.9 | |
| - name: Install workspace dependencies | |
| run: bun install | |
| - name: Build smoke dependency package (webtau) | |
| run: cd packages/webtau && bun run build | |
| - name: Build smoke dependency package (webtau-vite) | |
| run: cd packages/webtau-vite && bun run build | |
| - name: Build Electrobun counter (web target) | |
| run: | | |
| cd examples/electrobun-counter | |
| bun run test | |
| bun run build:web | |
| test -d dist | |
| test -f dist/index.html | |
| - name: Build Electrobun counter (hybrid BrowserWindow package target) | |
| run: | | |
| cd examples/electrobun-counter | |
| bun run build:electrobun:hybrid | |
| test -d build | |
| - name: Build Electrobun counter (GpuWindow package target) | |
| run: | | |
| cd examples/electrobun-counter | |
| bun run build:electrobun:gpu | |
| test -d build | |
| - name: Upload Electrobun smoke artifacts (on failure) | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: electrobun-smoke-artifacts | |
| path: | | |
| examples/electrobun-counter/dist | |
| examples/electrobun-counter/build | |
| if-no-files-found: ignore | |
| publish-preflight: | |
| name: Publish Preflight | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Cargo publish dry-run (webtau-macros) | |
| run: | | |
| echo "Expected output: packaging + verification logs and exit code 0." | |
| cargo publish -p webtau-macros --dry-run | |
| - name: Cargo publish dry-run (webtau) | |
| run: | | |
| echo "Expected output: packaging + verification logs. For unreleased prerelease dependencies, a version-mismatch error is acceptable before the release tag publish sequence." | |
| set +e | |
| dry_run_output="$(cargo publish -p webtau --dry-run 2>&1)" | |
| dry_run_status=$? | |
| set -e | |
| echo "$dry_run_output" | |
| if [ $dry_run_status -eq 0 ]; then | |
| exit 0 | |
| fi | |
| if [[ "$dry_run_output" == *"failed to select a version for the requirement"* ]] && [[ "$dry_run_output" == *"webtau-macros"* ]]; then | |
| echo "webtau dry-run hit expected prerelease dependency mismatch; validating crate integrity with cargo check instead." | |
| cargo check -p webtau | |
| exit 0 | |
| fi | |
| exit $dry_run_status | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.9 | |
| - name: Install workspace dependencies | |
| run: bun install | |
| - name: Build npm publishable packages | |
| run: | | |
| cd packages/webtau && bun run build | |
| cd ../webtau-vite && bun run build | |
| cd ../create-gametau && bun run build | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - name: Node ESM consumer smoke (packed webtau) | |
| run: | | |
| echo "Expected output: webtau import succeeds from packed local tarball in a clean Node consumer project." | |
| cd packages/webtau | |
| npm run smoke:esm-consumer | |
| - name: npm pack dry-run (webtau) | |
| run: | | |
| echo "Expected output: tarball metadata + file list and exit code 0." | |
| cd packages/webtau | |
| npm pack --dry-run | |
| - name: npm pack dry-run (webtau-vite) | |
| run: | | |
| echo "Expected output: tarball metadata + file list and exit code 0." | |
| cd packages/webtau-vite | |
| npm pack --dry-run | |
| - name: npm pack dry-run (create-gametau) | |
| run: | | |
| echo "Expected output: tarball metadata + file list and exit code 0." | |
| cd packages/create-gametau | |
| npm pack --dry-run | |
| release-gate-contract: | |
| name: Release Gate Contract | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Verify canonical gate docs exist | |
| run: | | |
| test -f .github/release/RELEASE-GATE-CHECKLIST.md | |
| test -f .github/release/RELEASE-INCIDENT-RESPONSE.md |