name: CI
on:
pull_request:
branches:
- main
- v2-stable
push:
branches:
- main
- v2-stable
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_LOG: info
jobs:
ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature: [sync, async]
name: CI ${{ matrix.feature }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.93.0
with:
components: rustfmt, clippy
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.feature }}
cache-on-failure: true
cache-targets: true
cache-all-crates: true
- name: Check formatting
run: cargo fmt -- --check
- name: Build
run: cargo build --features ${{ matrix.feature }}
- name: Run clippy
run: cargo clippy --all-targets --features ${{ matrix.feature }} -- -D warnings
- name: Run tests
run: cargo test --features ${{ matrix.feature }}
- name: Build examples
run: cargo build --examples --features ${{ matrix.feature }}
- name: Build documentation
run: cargo doc --no-deps --features ${{ matrix.feature }}
- name: Check benches compile
run: cargo check --benches --features ${{ matrix.feature }} || true
basic-checks:
runs-on: ubuntu-latest
name: Basic checks
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.93.0
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: basic-checks
- name: Check Cargo.toml
run: |
cargo metadata --format-version 1 > /dev/null
- name: Security audit
run: |
cargo install cargo-audit || true
cargo audit || true