lints and mutants #84
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: CI | |
on: | |
pull_request: | |
push: | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build & run tests for default and serde features | |
run: cargo test --features std,serde | |
- name: Build & run tests without libstd | |
run: cargo test --no-default-features --features const-random | |
- name: Build & run tests without libstd, but with serde | |
run: cargo test --no-default-features --features const-random,serde | |
miri: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: miri | |
override: true | |
- name: Test with Miri, default and serde features | |
run: cargo miri test --features std,serde | |
- name: Test with Miri, without libstd | |
run: cargo miri test --no-default-features --features const-random | |
- name: Test with Miri, without libstd but with serde | |
run: cargo miri test --no-default-features --features const-random,serde | |
mutation: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get number of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
id: cpu-cores | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-mutants | |
run: cargo install cargo-mutants | |
- name: Run mutant tests | |
run: cargo mutants --jobs ${{ steps.cpu-cores.outputs.count }} -- --features std,serde | |
- name: Archive results | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: mutation-report | |
path: mutants.out | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rustfmt, clippy | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run clippy | |
run: cargo clippy --workspace --all-targets --features std,serde -- -D warnings | |
- name: Run clippy for const-random feature | |
run: cargo clippy --workspace --all-targets --no-default-features --features const-random -- -D warnings | |
- name: Check format | |
run: cargo fmt --all -- --check | |
coverage: | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: llvm-tools-preview | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Generate code coverage | |
run: cargo llvm-cov --features std,serde --workspace --lcov --output-path lcov.info | |
- name: Generate code coverage for no_std | |
run: cargo llvm-cov --no-default-features --features const-random --workspace --lcov --output-path lcov_nostd.info | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: lcov.info,lcov_nostd.info | |
fail_ci_if_error: true |