mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-25 14:53:34 +00:00
* test: add WIT compatibility tests for all WASM tools and channels Adds CI and integration tests to catch WIT interface breakage across all 14 WASM extensions (10 tools + 4 channels). Previously, changing wit/tool.wit or wit/channel.wit could silently break guest-side tools that weren't rebuilt until release time. Three new pieces: 1. scripts/build-wasm-extensions.sh — builds all WASM extensions from source by reading registry manifests. Used by CI and locally. 2. tests/wit_compat.rs — integration tests that compile and instantiate each .wasm binary against the current wasmtime host linker with stubbed host functions. Catches added/removed/renamed WIT functions, signature mismatches, and missing exports. Skips gracefully when artifacts aren't built so `cargo test` still passes standalone. 3. .github/workflows/test.yml — new wasm-wit-compat CI job that builds all extensions then runs instantiation tests on every PR. Added to the branch protection roll-up. [skip-regression-check] Co-Authored-By: Claude Opus 4.6 <[email protected]> * style: fix rustfmt formatting in wit_compat tests Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix: address PR review feedback on WIT compat tests - Switch build script from python3 to jq for JSON parsing, consistent with release.yml and avoids python3 dependency (#1, #7) - Use dirs::home_dir() instead of HOME env var for portability (#2) - Filter extensions by manifest "kind" field instead of path (#3) - Replace .flatten() with explicit error handling in dir iteration (#4, #5) - Split stub_tool_host_functions into stub_shared_host_functions + tool-only tool-invoke stub, since tool-invoke is not in channel WIT (#6) Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
91 lines
2.6 KiB
YAML
91 lines
2.6 KiB
YAML
name: Run Tests
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
tests:
|
|
name: Tests (${{ matrix.name }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: all-features
|
|
flags: "--all-features"
|
|
- name: default
|
|
flags: ""
|
|
- name: libsql-only
|
|
flags: "--no-default-features --features libsql"
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
profile: minimal
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: ${{ matrix.name }}
|
|
- name: Run Tests
|
|
run: cargo test ${{ matrix.flags }} -- --nocapture
|
|
|
|
telegram-tests:
|
|
name: Telegram Channel Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
profile: minimal
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Run Telegram Channel Tests
|
|
run: cargo test --manifest-path channels-src/telegram/Cargo.toml -- --nocapture
|
|
|
|
wasm-wit-compat:
|
|
name: WASM WIT Compatibility
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
profile: minimal
|
|
targets: wasm32-wasip2
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: wasm-extensions
|
|
- name: Install cargo-component
|
|
run: cargo install cargo-component --locked || true
|
|
- name: Build all WASM extensions against current WIT
|
|
run: ./scripts/build-wasm-extensions.sh
|
|
- name: Instantiation test (host linker compatibility)
|
|
run: cargo test --all-features wit_compat -- --nocapture
|
|
|
|
docker-build:
|
|
name: Docker Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: Build Docker image
|
|
run: docker build -t ironclaw-test:ci .
|
|
|
|
# Roll-up job for branch protection
|
|
run-tests:
|
|
name: Run Tests
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
needs: [tests, telegram-tests, wasm-wit-compat, docker-build]
|
|
steps:
|
|
- run: |
|
|
if [[ "${{ needs.tests.result }}" != "success" || "${{ needs.telegram-tests.result }}" != "success" || "${{ needs.wasm-wit-compat.result }}" != "success" || "${{ needs.docker-build.result }}" != "success" ]]; then
|
|
echo "One or more jobs failed"
|
|
exit 1
|
|
fi
|