name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
build-and-test:
name: Quality Control
runs-on: ubuntu-latest
steps:
- name: checkout source code
uses: actions/checkout@v6
- name: install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
targets: thumbv7m-none-eabi, x86_64-pc-windows-msvc, x86_64-unknown-linux-musl
- name: enable Rust caching
uses: Swatinem/rust-cache@v2
- name: rustfmt
run: cargo fmt --all -- --check
- name: clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: clippy (no default features)
run: cargo clippy --all-targets --no-default-features -- -D warnings
- name: cargo check
run: cargo check --all-targets
- name: cargo check (no default features)
run: cargo check --all-targets --no-default-features
- name: cargo check (watermark)
run: cargo check --all-targets --no-default-features --features=watermark
- name: cargo check (histograms)
run: cargo check --all-targets --no-default-features --features=histograms
- name: cargo check (serde)
run: cargo check --all-targets --no-default-features --features=serde
- name: cargo check (fmt)
run: cargo check --all-targets --no-default-features --features=fmt
- name: cargo check (sampler)
run: cargo check --all-targets --no-default-features --features=sampler
- name: cargo check (hook_pthread)
run: cargo check --all-targets --no-default-features --features=hook_pthread
- name: cargo check (no_std target without native 64-bit atomics)
run: cargo check --no-default-features --target thumbv7m-none-eabi
- name: cargo check (no_std target, all portable features)
run: cargo check --no-default-features --features=watermark,histograms,serde --target thumbv7m-none-eabi
- name: cargo test
run: cargo test --features=full -- --test-threads 1
- name: cargo test (pthread interposition)
run: cargo test --features=full,hook_pthread -- --test-threads 1
- name: cargo test (release)
run: cargo test --release --features=full -- --test-threads 1
- name: cargo test (no default features)
run: cargo test --no-default-features -- --test-threads 1
- name: cargo doc (all features)
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
- name: cargo doc (default features)
run: cargo doc --no-deps
env:
RUSTDOCFLAGS: -D warnings
- name: cargo doc (no default features)
run: cargo doc --no-deps --no-default-features
env:
RUSTDOCFLAGS: -D warnings
- name: cargo doc (watermark without a sampler)
run: cargo doc --no-deps --no-default-features --features=std,watermark
env:
RUSTDOCFLAGS: -D warnings
- name: cargo check (windows)
run: cargo check --target x86_64-pc-windows-msvc --all-features
- name: cargo check (musl)
run: cargo check --target x86_64-unknown-linux-musl --all-features
msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- name: checkout source code
uses: actions/checkout@v6
- name: install Rust 1.85
uses: dtolnay/rust-toolchain@1.85
- name: enable Rust caching
uses: Swatinem/rust-cache@v2
- name: cargo check (all features)
run: cargo check --all-features
- name: cargo check (no default features)
run: cargo check --no-default-features