build: Update the linting workflow

Signed-off-by: Noah Knegt <git@noahknegt.com>
This commit is contained in:
2025-07-03 23:37:27 +02:00
parent 8c22757f71
commit 476f849ded

View File

@@ -7,18 +7,36 @@ env:
CARGO_TERM_COLOR: always
jobs:
cargo-fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
# Cache cargo registry
- name: Hash the lock file
uses: https://gitea.com/seepine/hash-files@v1
id: get-hash
with:
patterns: |
**/Cargo.lock
- name: Setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt,clippy
cache-shared-key: cargo-${{ steps.get-hash.outputs.hash }}
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
cargo-check:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt,clippy
# Cache cargo registry
- name: Hash the lock file
uses: https://gitea.com/seepine/hash-files@v1
@@ -26,37 +44,23 @@ jobs:
with:
patterns: |
**/Cargo.lock
- name: Cache cargo registry
uses: actions/cache@v3
- name: Setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ steps.get-hash.outputs.hash }}
restore-keys: |
cargo-
# Cache cargo registry - end
toolchain: stable
components: rustfmt,clippy
cache-shared-key: cargo-${{ steps.get-hash.outputs.hash }}
- name: Cargo check
uses: actions-rs/cargo@v1
with:
command: check
run: cargo check --workspace
clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt,clippy
# Cache cargo registry
- name: Hash the lock file
uses: https://gitea.com/seepine/hash-files@v1
@@ -64,22 +68,13 @@ jobs:
with:
patterns: |
**/Cargo.lock
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ steps.get-hash.outputs.hash }}
restore-keys: |
cargo-
# Cache cargo registry - end
- name: Run clippy
uses: actions-rs/clippy-check@v1
- name: Setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -Dwarnings
toolchain: stable
components: rustfmt,clippy
cache-shared-key: cargo-${{ steps.get-hash.outputs.hash }}
- name: Cargo check
run: cargo clippy --all-targets --all-features -- -Dwarnings