cargo clippy #2455
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci-linux | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- '**.rs' # only execute on changes to go files | |
- '**/Cargo.toml' # or dependency updates | |
- '.github/workflows/**' # or workflow changes | |
push: | |
branches: | |
- main | |
paths: | |
- '**.rs' # only execute on changes to go files | |
- '**/Cargo.toml' # or dependency updates | |
- '.github/workflows/**' # or workflow changes | |
jobs: | |
udeps: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Install cargo-udeps | |
uses: taiki-e/install-action@cargo-udeps | |
- name: Check unused dependencies on default features | |
run: cargo udeps | |
- name: Check unused dependencies on full features | |
run: cargo udeps --features full | |
- name: Check unused dependencies on all features | |
run: cargo udeps --all-features | |
msrv: | |
name: Check MSRV - x86_64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get MSRV from package metadata | |
id: msrv | |
run: grep rust-version Cargo.toml | cut -d'"' -f2 | sed 's/^/version=/' >> $GITHUB_OUTPUT | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ steps.msrv.outputs.version }} | |
components: rustfmt, clippy | |
- name: check crates | |
run: cargo check --all --bins --examples --tests | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- stable | |
# - nightly | |
name: Cargo check ${{ matrix.version }} - x86_64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.version }} | |
components: rustfmt, clippy | |
- name: check build | |
run: cargo check --all --bins --examples --tests | |
- name: check examples | |
run: cargo check --all --bins --examples --tests | |
working-directory: ./examples | |
- name: check release build | |
run: cargo check --all --bins --examples --tests --release | |
- name: Cargo test | |
timeout-minutes: 40 | |
run: cargo test --all --all-features --no-fail-fast -- --nocapture | |
hack: | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- nightly | |
name: Cargo check ${{ matrix.version }} - x86_64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
needs: [test] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.version }} | |
components: rustfmt, clippy | |
- name: Install cargo-hack | |
run: cargo install cargo-hack | |
- name: check --feature-powerset | |
run: cargo hack check --feature-powerset --depth 1 -Z avoid-dev-deps --exclude-features server --exclude-no-default-features | |
cover: | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- stable | |
# - nightly | |
name: Coverage ${{ matrix.version }} - x86_64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
needs: [hack] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.version }} | |
components: rustfmt, clippy | |
- name: Generate coverage file | |
if: matrix.version == 'stable' && (github.ref == 'refs/heads/main' || github.event_name == 'push') | |
run: | | |
cargo install cargo-tarpaulin | |
cargo tarpaulin --all-features --out xml | |
- name: Upload to codecov | |
if: matrix.version == 'stable' && (github.ref == 'refs/heads/main' || github.event_name == 'push') | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: cobertura.xml |