Add WASM tests and CI job #69
Workflow file for this run
This file contains 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: Crate | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
GRCOV_VERSION: v0.8.19 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
test-wasm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: wasm32-unknown-unknown | |
- name: Install wasm-pack | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: wasm-pack | |
- name: Run tests | |
run: wasm-pack test --headless --chrome --firefox | |
miri: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust nightly and miri | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: miri, rust-src | |
- name: Run miri | |
env: | |
RUSTFLAGS: -Zrandomize-layout | |
MIRIFLAGS: -Zmiri-symbolic-alignment-check | |
run: cargo miri test | |
code-coverage: | |
needs: [miri, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust stable and LLVM tools | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: llvm-tools-preview | |
- name: Install grcov | |
run: | | |
curl -L "https://github.com/mozilla/grcov/releases/download/$GRCOV_VERSION/grcov-x86_64-unknown-linux-musl.tar.bz2" | \ | |
tar xj -C "$HOME/.cargo/bin" | |
- name: Run cargo clean | |
run: cargo clean | |
- name: Run tests | |
env: | |
LLVM_PROFILE_FILE: "v_frame-%p-%m.profraw" | |
RUSTFLAGS: > | |
-Cinstrument-coverage -Ccodegen-units=1 -Clink-dead-code | |
-Coverflow-checks=off | |
RUSTDOCFLAGS: > | |
-Cinstrument-coverage -Ccodegen-units=1 -Clink-dead-code | |
-Coverflow-checks=off | |
run: cargo test | |
- name: Get coverage data for codecov | |
run: | | |
grcov . --binary-path ./target/debug/ -s . -t lcov --branch \ | |
--ignore-not-existing --ignore "/*" --ignore "../*" -o lcov.info | |
- name: Codecov upload | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: lcov.info |