From 65c4fd2fecc9dbb01e29753ba2b9969dec1c8a4d Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Fri, 19 Jul 2024 18:22:21 +0200 Subject: [PATCH] Add lint checks & change actions-rs/toolchain to dtolnay/rust-toolchain --- .github/workflows/linutil.yml | 6 ++---- .github/workflows/rust.yml | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/linutil.yml b/.github/workflows/linutil.yml index 34ce5d4c..30f7f8ad 100644 --- a/.github/workflows/linutil.yml +++ b/.github/workflows/linutil.yml @@ -30,13 +30,11 @@ jobs: key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo-index- - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + uses: dtolnay/rust-toolchain@stable - name: Build run: cargo build --target-dir=build --release --verbose - uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: Commit Linutil file_pattern: 'build/release/linutil' - if: success() \ No newline at end of file + if: success() diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 471af03f..a61e9fe3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,4 +1,4 @@ -name: Rust Check +name: Rust Checks on: pull_request: @@ -12,6 +12,7 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout sources - uses: actions/checkout@v4 - name: Cache Cargo registry uses: actions/cache@v4 @@ -26,8 +27,19 @@ jobs: key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo-index- - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + uses: dtolnay/rust-toolchain@stable - name: Build - run: cargo check \ No newline at end of file + run: cargo check + + lints: + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + - uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Run cargo fmt + run: cargo --fmt --all check + - name: Run cargo clippy + run: cargo clippy