Develop bindings for WASI versions in parallel #292
Workflow file for this run
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, pull_request] | |
| # Cancel any in-flight jobs for the same PR/branch so there's only one active | |
| # at a time | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test_wasip2: | |
| name: Test WASIp2 on ${{ matrix.rust }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| rust: [stable, beta, nightly] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: ./.github/actions/install-rust | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| - run: rustup target add wasm32-wasip2 wasm32-unknown-unknown | |
| - name: Install Wasmtime | |
| uses: bytecodealliance/actions/wasmtime/setup@v1 | |
| with: | |
| version: "v30.0.2" | |
| - name: Install wasm-tools | |
| uses: bytecodealliance/actions/wasm-tools/setup@v1 | |
| with: | |
| version: "1.224.0" | |
| - run: cargo build -p wasip2 --examples --target wasm32-wasip2 --no-default-features | |
| - run: wasmtime run ./target/wasm32-wasip2/debug/examples/hello-world-no_std.wasm | |
| - run: wasmtime run ./target/wasm32-wasip2/debug/examples/cli_command_no_std.wasm | |
| - run: cargo build -p wasip2 --examples --target wasm32-wasip2 | |
| - run: wasmtime run ./target/wasm32-wasip2/debug/examples/hello-world.wasm | |
| - run: wasmtime run ./target/wasm32-wasip2/debug/examples/cli_command.wasm | |
| - run: cargo build -p wasip2 --examples --target wasm32-unknown-unknown --no-default-features | |
| - run: wasm-tools component new ./target/wasm32-unknown-unknown/debug/examples/http_proxy_no_std.wasm -o component.wasm | |
| - run: wasm-tools component targets wit component.wasm -w wasi:http/proxy | |
| - run: cargo build -p wasip2 --examples --target wasm32-unknown-unknown | |
| - run: wasm-tools component new ./target/wasm32-unknown-unknown/debug/examples/http_proxy.wasm -o component.wasm | |
| - run: wasm-tools component targets wit component.wasm -w wasi:http/proxy | |
| - run: cargo build -p wasi-ext --examples --target wasm32-wasip2 --features rand | |
| - run: wasmtime run ./target/wasm32-wasip2/debug/examples/rand.wasm | |
| build: | |
| name: Build ${{ matrix.crate }} on ${{ matrix.rust }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| rust: [msrv, stable, beta, nightly] | |
| crate: [wasi, wasip1, wasip2] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: ./.github/actions/install-rust | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| - run: rustup target add wasm32-wasip1 wasm32-wasip2 | |
| - run: cargo build -p ${{ matrix.crate }} | |
| - run: cargo build -p ${{ matrix.crate }} --target wasm32-wasip1 | |
| - run: cargo build -p ${{ matrix.crate }} --target wasm32-wasip2 | |
| - run: cargo build --no-default-features -p ${{ matrix.crate }} | |
| - run: cargo build --no-default-features -p ${{ matrix.crate }} --target wasm32-wasip1 | |
| - run: cargo build --no-default-features -p ${{ matrix.crate }} --target wasm32-wasip2 | |
| - run: cargo test -p ${{ matrix.crate }} --doc | |
| generate: | |
| name: Ensure generated code up-to-date | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: ./.github/actions/install-rust | |
| # Re-vendor all WIT files and ensure that they're all up-to-date by ensuring | |
| # that there's no git changes. | |
| - name: Re-vendor WIT | |
| run: | | |
| ./ci/vendor-wit.sh | |
| git diff --exit-code | |
| - run: | | |
| version=0.45.0 | |
| mkdir wit-bindgen | |
| cd wit-bindgen | |
| curl -o wit-bindgen.tar.gz -L https://github.com/bytecodealliance/wit-bindgen/releases/download/v$version/wit-bindgen-$version-x86_64-linux.tar.gz | |
| tar xf wit-bindgen.tar.gz | |
| echo "PATH=$PATH:`pwd`/wit-bindgen-$version-x86_64-linux" >> $GITHUB_ENV | |
| working-directory: ${{ runner.tool_cache }} | |
| - run: ./ci/regenerate.sh | |
| - run: git diff --exit-code |