name: CI
on:
push:
branches:
- main
pull_request:
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
jobs:
formatting:
name: Check formatting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cache Cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache Cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
test:
name: Test on ${{ matrix.os }} / ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
toolchain:
- stable
- beta
- nightly
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install ${{ matrix.toolchain }} Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.toolchain }}
- name: Cargo check library, tests, and examples
run: cargo check --all-targets --all-features
- name: Run tests
run: cargo test --all-features
doc:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
- name: Run cargo doc
run: cargo doc --all-features