Skip to content

Commit

Permalink
Merge pull request #677 from acfoltzer/wasm32-wasi
Browse files Browse the repository at this point in the history
Add `wasm32-wasi` support with tests
  • Loading branch information
KodrAus committed May 28, 2023
2 parents 2cfe9f1 + 403f845 commit a0d6eb6
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 75 deletions.
2 changes: 2 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.wasm32-wasi]
runner = "wasmtime"
31 changes: 28 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ jobs:
- name: Version features
run: cargo +1.57.0 test --features "$VERSION_FEATURES"

wasm:
name: Tests / WebAssembly
wasm_bindgen:
name: Tests / WebAssembly (wasm-bindgen)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand All @@ -104,11 +104,36 @@ jobs:
run: wasm-pack test --node

- name: Version features
run: wasm-pack test --node -- --features "$VERION_FEATURES $DEP_FEATURES js"
run: wasm-pack test --node -- --features "$VERSION_FEATURES $DEP_FEATURES js"

- name: Fast RNG
run: wasm-pack test --node -- --features "js v4 fast-rng"

wasi:
name: Tests / WebAssembly (WASI)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab

- name: Install Wasmtime
run: curl https://wasmtime.dev/install.sh -sSf | bash

- name: Add Wasmtime to path
run: echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH

- name: Install wasm32-wasi target
run: rustup target add wasm32-wasi

- name: Default features
run: cargo test --target wasm32-wasi

- name: Version features
run: cargo test --target wasm32-wasi --features "$VERSION_FEATURES $DEP_FEATURES"

- name: Fast RNG
run: cargo test --target wasm32-wasi --features "v4 fast-rng"

mips:
name: Tests / MIPS (Big Endian)
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ version = "1.0"
[dev-dependencies.serde_test]
version = "1.0.56"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies.wasm-bindgen]
[target.'cfg(target = "wasm32-unknown-unknown")'.dev-dependencies.wasm-bindgen]
package = "wasm-bindgen"
version = "0.2"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies.wasm-bindgen-test]
[target.'cfg(target = "wasm32-unknown-unknown")'.dev-dependencies.wasm-bindgen-test]
version = "0.3"

[dev-dependencies.trybuild]
Expand Down
Loading

0 comments on commit a0d6eb6

Please sign in to comment.