name: CI
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
env:
RUSTFLAGS: -Dwarnings
CARGO_TERM_COLOR: always
jobs:
pre_ci:
uses: dtolnay/.github/.github/workflows/pre_ci.yml@master
test:
name: Rust ${{matrix.rust}}
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [stable, beta, 1.83.0, nightly]
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
components: rust-src
- name: Enable type layout randomization
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
if: matrix.rust == 'nightly'
- name: Override rust-toolchain.toml if beta or nightly
run: "echo '[toolchain]\nchannel = \"${{matrix.rust}}\"' > rust-toolchain.toml"
if: matrix.rust == 'nightly' || matrix.rust == 'beta'
- uses: taiki-e/install-action@v2
with:
tool: nextest
- run: cargo nextest run --all-features && cargo test --all-features --doc
- run: cargo check --no-default-features
- run: cargo check
minimal:
name: Minimal versions
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- run: cargo +nightly generate-lockfile -Z minimal-versions
- run: cargo +nightly check --locked
windows:
name: Windows
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: windows-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rust-src
- run: cargo check
doc:
name: Documentation
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- uses: dtolnay/install@cargo-docs-rs
- run: cargo +nightly docs-rs
hack:
name: Hack
runs-on: ubuntu-latest
needs: pre_ci
if: needs.pre_ci.outputs.continue
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rust-src
- uses: taiki-e/install-action@cargo-hack
- run: cargo hack --optional-deps --feature-powerset --group-features eyre,hooks --group-features anyhow,serde --ignore-unknown-features clippy --all-targets --no-deps
clippy:
name: Clippy
runs-on: ubuntu-latest
needs: pre_ci
if: needs.pre_ci.outputs.continue
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rust-src
- run: cargo clippy --all-features --all-targets --no-deps
miri:
name: Miri
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: miri, rust-src
- run: cargo +nightly miri setup
- run: cargo +nightly miri test --lib --bins --tests --all-features
env:
MIRIFLAGS: -Zmiri-strict-provenance