name: CI
on:
push:
pull_request:
schedule:
- cron: '0 5 * * 1'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
rust:
name: Rust checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo build artifacts
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Lint with clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-targets --all-features
- name: Build docs (warnings are errors)
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --all-features --no-deps
audit:
name: Dependency audit
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'schedule'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install stable Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo build artifacts
uses: Swatinem/rust-cache@v2
- name: Install cargo-audit
uses: taiki-e/install-action@cargo-audit
- name: Run cargo audit
run: cargo audit