name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: test (${{ matrix.rust }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [stable, "1.85"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- name: Test (default, no_std-shaped)
run: cargo test
- name: Test (alloc feature)
run: cargo test --features alloc
- name: Doctests
run: cargo test --doc
- name: Every feature combination compiles
run: cargo hack --feature-powerset --no-dev-deps check
lint:
name: fmt + clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Formatting
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --all-targets --features alloc -- -D warnings
docs:
name: doc build
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build docs (deny warnings, broken links)
run: cargo doc --no-deps --all-features
no_std:
name: bare-metal (thumbv7em-none-eabi)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: thumbv7em-none-eabi, thumbv7em-none-eabihf
- uses: Swatinem/rust-cache@v2
- name: Build for bare metal (no default features)
run: cargo build --no-default-features --target thumbv7em-none-eabi
- name: Build embedded example — soft-float (links a firmware image)
run: cargo build --example embedded_curve_fit --no-default-features --features embedded --target thumbv7em-none-eabi
- name: Build embedded example — hardware-FPU (links a firmware image)
run: cargo build --example embedded_curve_fit --no-default-features --features embedded --target thumbv7em-none-eabihf
package:
name: package + examples/benches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build examples
run: cargo build --examples
- name: Build benches
run: cargo build --benches
- name: Packaging dry-run
run: cargo publish --dry-run