diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29354d1..177218c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,3 +80,13 @@ jobs: - uses: dtolnay/rust-toolchain@nightly - run: cargo update -Z minimal-versions - run: cargo check --all-features + + wasm: + name: WASM + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + - run: cargo check --all-features --target wasm32-unknown-unknown diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d6424b..14bcf55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Enable semver checks in CI - Add `documentation` to `Cargo.toml` +### Fixed + +- Fix WASM build + ## [0.1.0](https://github.com/LDeakin/microfloat/releases/tag/v0.1.0) - 2026-04-28 ### Added diff --git a/Cargo.lock b/Cargo.lock index a021887..61c4308 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,9 +88,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi", "wasip2", + "wasm-bindgen", ] [[package]] @@ -136,6 +138,7 @@ name = "microfloat" version = "0.1.0" dependencies = [ "bytemuck", + "getrandom", "libm", "num-traits", "proptest", diff --git a/Cargo.toml b/Cargo.toml index b52718c..2f9bb3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,5 +34,8 @@ rand_distr = ["dep:rand", "dep:rand_distr"] [dev-dependencies] proptest = { version = "1.11", default-features = false, features = ["std"] } +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.3", features = ["wasm_js"] } + [package.metadata.docs.rs] all-features = true