| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
push: |
| 6 |
|
| 7 |
jobs: |
| 8 |
test: |
| 9 |
strategy: |
| 10 |
matrix: |
| 11 |
os: [windows-latest, ubuntu-latest] |
| 12 |
runs-on: ${{ matrix.os }} |
| 13 |
steps: |
| 14 |
- uses: actions/checkout@v4 |
| 15 |
- uses: actions-rs/toolchain@v1 |
| 16 |
with: |
| 17 |
toolchain: nightly |
| 18 |
override: true |
| 19 |
- uses: Swatinem/rust-cache@v2 |
| 20 |
- name: Build & run tests |
| 21 |
run: cargo test --all-features |
| 22 |
- name: Build without libstd |
| 23 |
run: cargo build --no-default-features |
| 24 |
- name: Build without libstd with serde |
| 25 |
run: cargo build --no-default-features --features serde |
| 26 |
miri: |
| 27 |
runs-on: ubuntu-latest |
| 28 |
steps: |
| 29 |
- uses: actions/checkout@v4 |
| 30 |
- uses: actions-rs/toolchain@v1 |
| 31 |
with: |
| 32 |
toolchain: nightly |
| 33 |
components: miri |
| 34 |
override: true |
| 35 |
- name: Test with Miri |
| 36 |
run: cargo miri test --all-features |
| 37 |
mutation: |
| 38 |
runs-on: ubuntu-latest |
| 39 |
steps: |
| 40 |
- name: Get number of CPU cores |
| 41 |
uses: SimenB/github-actions-cpu-cores@v2 |
| 42 |
id: cpu-cores |
| 43 |
- uses: actions/checkout@v4 |
| 44 |
- uses: actions-rs/toolchain@v1 |
| 45 |
with: |
| 46 |
toolchain: nightly |
| 47 |
override: true |
| 48 |
- uses: Swatinem/rust-cache@v2 |
| 49 |
- name: Install cargo-mutants |
| 50 |
run: cargo install cargo-mutants |
| 51 |
- name: Run mutant tests |
| 52 |
run: cargo mutants --jobs ${{ steps.cpu-cores.outputs.count }} -- --all-features |
| 53 |
- name: Archive results |
| 54 |
uses: actions/upload-artifact@v3 |
| 55 |
if: failure() |
| 56 |
with: |
| 57 |
name: mutation-report |
| 58 |
path: mutants.out |
| 59 |
lint: |
| 60 |
runs-on: ubuntu-latest |
| 61 |
steps: |
| 62 |
- uses: actions/checkout@v4 |
| 63 |
- uses: actions-rs/toolchain@v1 |
| 64 |
with: |
| 65 |
toolchain: nightly |
| 66 |
components: rustfmt, clippy |
| 67 |
override: true |
| 68 |
- uses: Swatinem/rust-cache@v2 |
| 69 |
- name: Run clippy |
| 70 |
run: cargo clippy --workspace --all-targets --all-features -- -D warnings |
| 71 |
- name: Check format |
| 72 |
run: cargo fmt --all -- --check |
| 73 |
coverage: |
| 74 |
runs-on: ubuntu-latest |
| 75 |
env: |
| 76 |
CARGO_TERM_COLOR: always |
| 77 |
steps: |
| 78 |
- uses: actions/checkout@v4 |
| 79 |
- uses: actions-rs/toolchain@v1 |
| 80 |
with: |
| 81 |
toolchain: nightly |
| 82 |
components: llvm-tools-preview |
| 83 |
override: true |
| 84 |
- uses: Swatinem/rust-cache@v2 |
| 85 |
- name: Install cargo-llvm-cov |
| 86 |
uses: taiki-e/install-action@cargo-llvm-cov |
| 87 |
- name: Generate code coverage |
| 88 |
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info |
| 89 |
- name: Upload coverage to Codecov |
| 90 |
uses: codecov/codecov-action@v3 |
| 91 |
with: |
| 92 |
files: lcov.info |
| 93 |
fail_ci_if_error: true |