name: Test & Lint
on: [push, pull_request]
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings -W rust-2021-compatibility"
RUSTUP_MAX_RETRIES: 10
defaults:
run:
shell: bash
jobs:
test:
name: Test Suite
runs-on: ubuntu-24.04
env:
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
steps:
- name: Checkout sources
uses: actions/checkout@v7
- name: Install toolchain
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
- name: Cache
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@60c08ce81d769135aafd96f96efc85993d9cb8e4
- name: Test and generate coverage
run: >-
cargo llvm-cov --all-features --workspace --lcov
--remap-path-prefix --output-path lcov.info
- name: Upload coverage to Codacy
if: env.CODACY_API_TOKEN != ''
uses: codacy/codacy-coverage-reporter-action@89d6c85cfafaec52c72b6c5e8b2878d33104c699 with:
api-token: ${{ env.CODACY_API_TOKEN }}
coverage-reports: lcov.info
language: Rust
force-coverage-parser: lcov
lints:
name: Lints
runs-on: ubuntu-24.04
steps:
- name: Checkout sources
uses: actions/checkout@v7
- name: Install toolchain
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c with:
components: rustfmt, clippy
- name: Cache
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6
- name: Run cargo fmt
run: cargo fmt --all -- --check --color always
- name: Run cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings