|
| 1 | +on: |
| 2 | + pull_request: |
| 3 | + workflow_dispatch: |
| 4 | + |
| 5 | +name: Clippy check |
| 6 | + |
| 7 | +# Make sure CI fails on all warnings, including Clippy lints |
| 8 | +env: |
| 9 | + RUSTFLAGS: "-Dwarnings" |
| 10 | + |
| 11 | +jobs: |
| 12 | + fmt_check: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - name: Check if code is formatted properly |
| 17 | + run: cargo fmt --check --all |
| 18 | + |
| 19 | + clippy_check: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - name: Cache Cargo Registry |
| 24 | + uses: actions/cache@v3 |
| 25 | + with: |
| 26 | + path: ~/.cargo/registry |
| 27 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} |
| 28 | + restore-keys: | |
| 29 | + ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} |
| 30 | + - name: Run Clippy |
| 31 | + run: cargo clippy --all-targets --all-features |
| 32 | + |
| 33 | + udeps: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - name: Cache Cargo Binaries |
| 37 | + uses: actions/cache@v3 |
| 38 | + with: |
| 39 | + path: ~/.cargo/bin |
| 40 | + key: ${{ runner.os }}-cargo-bin |
| 41 | + restore-keys: | |
| 42 | + ${{ runner.os }}-cargo-bin |
| 43 | +
|
| 44 | + - name: Cache Rust Toolchain |
| 45 | + uses: actions/cache@v3 |
| 46 | + with: |
| 47 | + path: | |
| 48 | + ~/.rustup/toolchains |
| 49 | + ~/.rustup/update-hashes |
| 50 | + key: ${{ runner.os }}-rust-toolchain-${{ hashFiles('rust-toolchain') }} |
| 51 | + restore-keys: | |
| 52 | + ${{ runner.os }}-rust-toolchain-${{ hashFiles('rust-toolchain') }} |
| 53 | +
|
| 54 | + - name: Cache Cargo Registry |
| 55 | + uses: actions/cache@v3 |
| 56 | + with: |
| 57 | + path: ~/.cargo/registry |
| 58 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} |
| 59 | + restore-keys: | |
| 60 | + ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} |
| 61 | +
|
| 62 | + - uses: actions/checkout@v4 |
| 63 | + - name: Install nightly |
| 64 | + run: rustup toolchain install nightly |
| 65 | + - name: Install udeps |
| 66 | + run: cargo install cargo-udeps --locked |
| 67 | + - name: Run udeps |
| 68 | + run: cargo +nightly udeps |
0 commit comments