name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 with:
toolchain: nightly
components: rustfmt
cache: false
rustflags: ""
- run: cargo fmt --all --check
clippy:
name: Clippy (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 with:
toolchain: stable
components: clippy
rustflags: ""
- name: Run clippy
run: |
cargo clippy --all-targets --all-features -- -D warnings
cargo clippy --lib --no-default-features -- -D warnings
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 with:
toolchain: stable
rustflags: ""
- name: Run tests
run: |
cargo test --all-features
cargo test --lib --no-default-features
msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 with:
toolchain: "1.96"
rustflags: ""
- run: cargo test --locked --all-features
coverage:
name: Coverage
runs-on: ubuntu-latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 with:
toolchain: stable
components: llvm-tools
rustflags: ""
- uses: taiki-e/install-action@6ed6112eb9893c58dd600eebccdf6e77ab7bfa9c with:
tool: cargo-llvm-cov
- name: Enforce 90% line coverage
run: cargo llvm-cov --workspace --all-features --fail-under-lines 90 --lcov --output-path lcov.info
- name: Upload to Codecov
if: ${{ !cancelled() && env.CODECOV_TOKEN != '' }}
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 with:
files: lcov.info
fail_ci_if_error: true
machete:
name: Unused dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 with:
toolchain: stable
rustflags: ""
- uses: taiki-e/install-action@6ed6112eb9893c58dd600eebccdf6e77ab7bfa9c with:
tool: cargo-machete
- run: cargo machete
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 with:
toolchain: stable
rustflags: ""
- name: Build docs
run: |
cargo doc --all-features --no-deps
cargo doc --no-default-features --no-deps
env:
RUSTDOCFLAGS: -D rustdoc::broken-intra-doc-links -D rustdoc::private-intra-doc-links