name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Format, lint, test, docs, and package
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v7.0.1
- name: Install stable Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
- name: Lint all targets and features
run: cargo clippy --locked --all-targets --all-features -- -D warnings
- name: Test default features
run: cargo test --locked
- name: Test all features
run: cargo test --all-features --locked
- name: Check examples
run: cargo check --examples --locked
- name: Check serde feature alone
run: cargo check --locked --no-default-features --features serde
- name: Check tracing feature alone
run: cargo check --locked --no-default-features --features tracing
- name: Build documentation
run: cargo doc --all-features --no-deps --locked
env:
RUSTDOCFLAGS: -D warnings
- name: Verify crate package
run: cargo package --locked
msrv:
name: Minimum supported Rust version
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v7.0.1
- name: Install Rust 1.89.0
uses: dtolnay/rust-toolchain@1.89.0
- name: Check all targets and features at MSRV
run: cargo check --locked --all-targets --all-features
musl:
name: Musl build
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v7.0.1
- name: Install stable Rust with musl target
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Install musl C toolchain
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends musl-tools
- name: Check musl build
run: cargo check --locked --all-features --target x86_64-unknown-linux-musl
env:
CC_x86_64_unknown_linux_musl: musl-gcc
CMAKE_C_COMPILER: musl-gcc
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc