Fix clippy warnings and errors #27
Workflow file for this run
This file contains hidden or 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 — fmt, clippy, build, test | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| env: | |
| CARGO_CACHE_PATH: ~/.cargo/registry | |
| CARGO_GIT_PATH: ~/.cargo/git | |
| TARGET_DIR: target | |
| jobs: | |
| # Fast checks that run in parallel (no build artifacts needed) | |
| checks: | |
| name: fmt + clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Initialize git submodules | |
| run: git submodule update --init --recursive | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ env.CARGO_CACHE_PATH }} | |
| ${{ env.CARGO_GIT_PATH }} | |
| key: ${{ runner.os }}-cargo-checks-${{ hashFiles('**/Cargo.lock', 'envoy-data-plane-api/build.rs') }} | |
| - name: Install protoc | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - name: Setup Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| profile: minimal | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy (default features, recommended) | |
| run: cargo clippy --all-targets -- -D warnings | |
| # Optionally, test allocators individually (never together): | |
| - name: Run clippy (jemalloc) | |
| run: cargo clippy --all-targets --no-default-features --features jemalloc -- -D warnings | |
| - name: Run clippy (dhat-heap) | |
| run: cargo clippy --all-targets --no-default-features --features dhat-heap -- -D warnings | |
| # Do NOT use --all-features: jemalloc and dhat-heap are mutually exclusive and will cause a build failure. | |
| # Build and test that share artifacts | |
| build-and-test: | |
| name: build + test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Initialize git submodules | |
| run: git submodule update --init --recursive | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ env.CARGO_CACHE_PATH }} | |
| ${{ env.CARGO_GIT_PATH }} | |
| ${{ env.TARGET_DIR }} | |
| key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock', 'envoy-data-plane-api/build.rs') }} | |
| - name: Install protoc | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - name: Setup Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| profile: minimal | |
| - name: Build (release) | |
| run: cargo build --workspace --release --locked | |
| - name: Run tests | |
| run: cargo test --workspace --release --locked |