name: Build & Test
permissions: {}
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
- ci
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
jobs:
test:
strategy:
matrix:
toolchain: [stable, beta, nightly, 1.80.0]
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.toolchain != 'stable' }}
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
run: |
rustup toolchain install "${{ matrix.toolchain }}" --profile=minimal --component=clippy --component=rustfmt
rustup toolchain install nightly --profile=minimal
rustup override set "${{ matrix.toolchain }}"
- uses: Swatinem/rust-cache@v2.8.0
- run: cargo +nightly update -Zdirect-minimal-versions
- name: Compile (no features)
run: cargo test --no-default-features --timings --no-run
- name: Run tests (no features)
run: cargo test --no-default-features
- name: Compile (all features)
run: cargo test --all-features --timings --no-run
- name: Run tests (all features)
run: cargo test --all-features
- if: ${{ matrix.toolchain != '1.80.0' }}
run: cargo update
- name: Compile with updates
if: ${{ matrix.toolchain != '1.80.0' }}
run: cargo test --timings --no-run
- name: Test with updates
if: ${{ matrix.toolchain != '1.80.0' }}
run: cargo test --timings
- name: Save cargo --timings output
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: cargo-timings test ${{ matrix.toolchain }}
path: |
target/cargo-timings/cargo-timing-*.html
lint:
strategy:
fail-fast: false
matrix:
toolchain: ["stable", "nightly", "beta"]
runs-on: ubuntu-latest
continue-on-error: false
env:
RUSTFLAGS: '-Dwarnings'
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
run: |
rustup toolchain install "${{ matrix.toolchain }}" --profile=minimal --component=clippy
rustup override set "${{ matrix.toolchain }}"
- uses: Swatinem/rust-cache@v2.8.0
with:
cache-on-failure: true
- name: Lint
run: |
cargo clippy --timings
cargo rustdoc -- -Drustdoc::broken_intra_doc_links
- name: Save cargo --timings output
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: cargo-timings lint ${{ matrix.toolchain }}
path: |
target/cargo-timings/cargo-timing-*.html
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: cargo fmt --check
no_std:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
run: |
rustup toolchain install stable --profile minimal
rustup target add thumbv7em-none-eabihf
- name: no_std lint
run: |
cargo clippy --target=thumbv7em-none-eabihf --no-default-features
- name: no_std build
run: |
cargo build --target=thumbv7em-none-eabihf --no-default-features
incremental-mutants:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2.8.0
with:
cache-on-failure: true
- run: cargo install --locked cargo-mutants@24.7.1
- name: Relative diff
run: |
git branch -av
git diff origin/${{ github.base_ref }}.. | tee git.diff
- name: Mutants
run: cargo mutants --in-diff git.diff -- --all-features
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: mutants-incremental.out
path: mutants.out
semver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2.8.0
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2.8
env:
CARGO_TARGET_DIR: target/
with:
package: "exhaust"