name: Rust
on:
push:
branches: [master]
paths:
- "**.rs"
- "Cargo.toml"
- ".github/workflows/rust.yml"
pull_request:
branches: [master]
paths:
- "**.rs"
- "Cargo.toml"
- ".github/workflows/rust.yml"
env:
CARGO_TERM_COLOR: always
jobs:
rust:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- nightly
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
target/
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.rust }}-
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
components: clippy
- run: cargo clippy -- -D warnings
- run: cargo build --verbose
- run: cargo test --all-features --verbose
- run: |
cargo install cargo-tarpaulin || true
cargo tarpaulin --out xml
- uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true verbose: true