| 1 |
name: Crate |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ "main" ] |
| 6 |
pull_request: |
| 7 |
branches: [ "main" ] |
| 8 |
|
| 9 |
env: |
| 10 |
CARGO_TERM_COLOR: always |
| 11 |
CARGO_INCREMENTAL: 0 |
| 12 |
|
| 13 |
jobs: |
| 14 |
build: |
| 15 |
runs-on: ubuntu-latest |
| 16 |
|
| 17 |
steps: |
| 18 |
- uses: actions/checkout@v4 |
| 19 |
- name: Build |
| 20 |
run: cargo clippy |
| 21 |
- name: Run tests |
| 22 |
run: cargo test |
| 23 |
- name: Install cargo-msrv |
| 24 |
uses: taiki-e/install-action@v2 |
| 25 |
with: |
| 26 |
tool: cargo-msrv |
| 27 |
- name: Validate minimum Rust version |
| 28 |
run: | |
| 29 |
cargo msrv verify |
| 30 |
|
| 31 |
test-wasm: |
| 32 |
runs-on: ubuntu-latest |
| 33 |
|
| 34 |
steps: |
| 35 |
- uses: actions/checkout@v4 |
| 36 |
- uses: dtolnay/rust-toolchain@stable |
| 37 |
with: |
| 38 |
targets: wasm32-unknown-unknown |
| 39 |
|
| 40 |
- name: Install wasm-pack |
| 41 |
uses: taiki-e/install-action@v2 |
| 42 |
with: |
| 43 |
tool: wasm-pack |
| 44 |
|
| 45 |
- name: Run tests |
| 46 |
run: wasm-pack test --headless --chrome --firefox |
| 47 |
|
| 48 |
miri: |
| 49 |
runs-on: ubuntu-latest |
| 50 |
|
| 51 |
steps: |
| 52 |
- uses: actions/checkout@v4 |
| 53 |
|
| 54 |
- name: Install Rust nightly and miri |
| 55 |
uses: dtolnay/rust-toolchain@nightly |
| 56 |
with: |
| 57 |
components: miri, rust-src |
| 58 |
|
| 59 |
- name: Run miri |
| 60 |
env: |
| 61 |
RUSTFLAGS: -Zrandomize-layout |
| 62 |
MIRIFLAGS: -Zmiri-symbolic-alignment-check |
| 63 |
run: cargo miri test |
| 64 |
|
| 65 |
code-coverage: |
| 66 |
needs: [ miri, build ] |
| 67 |
runs-on: ubuntu-latest |
| 68 |
|
| 69 |
steps: |
| 70 |
- uses: actions/checkout@v4 |
| 71 |
|
| 72 |
- name: Install Rust stable and LLVM tools |
| 73 |
uses: dtolnay/rust-toolchain@stable |
| 74 |
with: |
| 75 |
components: llvm-tools-preview |
| 76 |
|
| 77 |
- name: Install cargo-llvm-cov |
| 78 |
uses: taiki-e/install-action@v2 |
| 79 |
with: |
| 80 |
tool: cargo-llvm-cov |
| 81 |
|
| 82 |
- name: Generate code coverage |
| 83 |
run: cargo llvm-cov --lcov --output-path lcov.log |
| 84 |
|
| 85 |
- name: Upload coverage to Codecov |
| 86 |
uses: codecov/codecov-action@v5 |
| 87 |
with: |
| 88 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 89 |
files: lcov.log |
| 90 |
fail_ci_if_error: true |