name: Rust
on:
push:
branches: ["main", "dev"]
pull_request:
branches: ["main", "dev"]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CLICOLOR_FORCE: 1
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
jobs:
checks:
name: checks @${{ matrix.rust-version }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false matrix:
rust-version: [1.74.0, stable]
cache: [true]
include:
- rust-version: nightly
cache: false
steps:
- uses: actions/checkout@v4
- name: Install Rust ${{ matrix.rust-version }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
components: rustfmt,clippy,rust-src
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 with:
key: ${{ matrix.rust-version }}
cache-on-failure: true
if: ${{ matrix.cache && !cancelled() }}
- run: cargo fmt --all --check
if: ${{ !cancelled() }}
- run: cargo test --all-features
- run: cargo clippy --tests --workspace
if: ${{ !cancelled() }}
docs:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-07-31
components: rust-src
- uses: dtolnay/install@cargo-docs-rs
- uses:
Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 with:
cache-on-failure: true
- run: cargo docs-rs
- run: cargo doc --no-deps --document-private-items
if: ${{ !cancelled() }}
coverage:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses:
dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-07-31
components: llvm-tools-preview,rust-src
- uses:
taiki-e/install-action@33734a118689b0b418824fb78ea2bf18e970b43b with:
tool: cargo-llvm-cov
checksum: true
- uses:
Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 with:
cache-on-failure: true
cache-all-crates: true
- name: Run coverage tests
run: cargo llvm-cov --all-features --workspace --exclude xtask@0.0.0 --lcov --output-path lcov.info
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: lcov.info
path: lcov.info
- name: Send result to codecov
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 with:
name: lcov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}