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 -- -D clippy::all -A clippy::needless_borrow -A clippy::large_enum_variant
cargo clippy --all-targets --features decimal -- -D clippy::all -A clippy::needless_borrow -A clippy::large_enum_variant
cargo clippy --lib --no-default-features -- -D clippy::all -A clippy::needless_borrow -A clippy::large_enum_variant
cargo clippy --lib --no-default-features --features decimal -- -D clippy::all -A clippy::needless_borrow -A clippy::large_enum_variant
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
cargo test --features decimal
cargo test --lib --no-default-features
cargo test --lib --no-default-features --features decimal
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: ""
- name: Run MSRV tests
run: |
cargo test --locked
cargo test --locked --lib --no-default-features
coverage:
name: Coverage
runs-on: ubuntu-latest
env:
HAS_CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN != '' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 with:
toolchain: nightly
components: llvm-tools
rustflags: ""
- uses: taiki-e/install-action@6887963ccf37a9ddcd8c5fa4baeb3e1e5fd61fa1 with:
tool: cargo-llvm-cov@0.8.7
fallback: none
- name: Enforce 90% line coverage
run: RUSTFLAGS='--cfg coverage_nightly' cargo +nightly llvm-cov --workspace --fail-under-lines 90 --lcov --output-path lcov.info
- name: Upload to Codecov
if: ${{ !cancelled() && env.HAS_CODECOV_TOKEN == 'true' }}
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
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@6887963ccf37a9ddcd8c5fa4baeb3e1e5fd61fa1 with:
tool: cargo-machete@0.9.2
fallback: none
- 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 --no-deps
cargo doc --lib --no-default-features --no-deps
env:
RUSTDOCFLAGS: -D rustdoc::broken-intra-doc-links -D rustdoc::private-intra-doc-links