name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable, beta]
exclude:
- os: macos-latest
rust: beta
- os: windows-latest
rust: beta
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy, rustfmt
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.rust }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
if: matrix.rust == 'stable'
- name: Run tests
run: cargo test --all-features --verbose
- name: Check documentation
run: cargo doc --no-deps --all-features
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
minimum-supported-rust-version:
name: Minimum Supported Rust Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust 1.80
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.80.0
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-1.80.0-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check MSRV
run: cargo check --all-features