build: Support building on `wasm32-unknown-unknown` without default features

* Don't depend on a particular ahash rng

* chore: Use `getrandom/js` on `wasm32`

* ci: Run `cargo build` for `wasm32-unknown-unknown`

Co-authored-by: Dmitry Dygalo <dmitry@dygalo.dev>
This commit is contained in:
Sam Wilson 2023-01-14 17:40:07 -05:00 committed by GitHub
parent 7699de0e9b
commit 4fc6181b27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 1 deletions

View File

@ -65,6 +65,38 @@ jobs:
- run: cargo test --no-fail-fast --features ${{ matrix.draft }}
working-directory: ./jsonschema
build-wasm32:
strategy:
fail-fast: false
matrix:
target: ['wasm32-unknown-unknown']
name: Build on ${{ matrix.target }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: stable-${{ matrix.target }}-cargo-cache
- run: cargo build --target ${{ matrix.target }} --no-default-features --features=cli
working-directory: ./jsonschema
coverage:
name: Run test coverage
runs-on: ubuntu-20.04
@ -164,7 +196,6 @@ jobs:
run: pip install dist/*
working-directory: ./bindings/python
fmt:
name: Rustfmt
runs-on: ubuntu-20.04

View File

@ -47,6 +47,9 @@ time = { version = "0.3", features = ["parsing", "macros"] }
url = "2.2"
uuid = "1"
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }
[dev-dependencies]
bench_helpers = { path = "../bench_helpers" }
criterion = { version = "0.4.0", features = [], default-features = false }