name: Rust CI
on: push
env:
CARGO_TERM_COLOR: always
jobs:
rustfmt_check:
name: Rustfmt Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: rustfmt-check
run: cargo fmt --all --check
clippy_check:
name: Clippy Check
runs-on: ubuntu-latest
strategy:
matrix:
feature_flags:
- "--workspace --all-features"
- "--workspace"
- "--workspace --no-default-features --tests --features tinyvec"
- "--workspace --no-default-features --tests --features arrayvec"
- "--workspace --no-default-features --tests --features smallvec"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: clippy
- uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-review'
github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: -- -Dwarnings
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.65.0
feature_flags:
- "--workspace --all-features"
- "--workspace --no-default-features --tests --features tinyvec"
- "--workspace --no-default-features --tests --features arrayvec"
- "--workspace --no-default-features --tests --features smallvec"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- name: cargo test
run: cargo test --all-targets ${{ matrix.feature_flags }}
coverage:
name: Code coverage
runs-on: ubuntu-latest
strategy:
matrix:
feature_flags:
- "--workspace --all-features"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov ${{ matrix.feature_flags }} --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false