Test WASI on CI

This commit is contained in:
Taiki Endo 2022-12-02 23:29:03 +09:00
parent 7622e382a1
commit f842ba6cf1
4 changed files with 17 additions and 6 deletions

View File

@ -41,6 +41,17 @@ jobs:
- run: cargo bench
if: startsWith(matrix.rust, 'nightly')
wasi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update stable
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: wasm32-wasi
- run: cargo test --target wasm32-wasi
msrv:
runs-on: ubuntu-latest
strategy:

View File

@ -14,10 +14,10 @@ keywords = ["simple", "fast", "rand", "random", "wyrand"]
categories = ["algorithms"]
exclude = ["/.*"]
[target.'cfg(target_arch = "wasm32")'.dependencies]
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies]
instant = "0.1"
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dev-dependencies]
instant = { version = "0.1", features = ["wasm-bindgen"] }
wasm-bindgen-test = "0.3"
getrandom = { version = "0.2", features = ["js"] }

View File

@ -75,9 +75,9 @@ use std::hash::{Hash, Hasher};
use std::ops::{Bound, RangeBounds};
use std::thread;
#[cfg(target_arch = "wasm32")]
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use instant::Instant;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
use std::time::Instant;
/// A random number generator.

View File

@ -1,7 +1,7 @@
#[cfg(target_family = "wasm")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(target_family = "wasm")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
#[test]