From 16c78340a3778e40e37bcc88d8e8e6e37b31052e Mon Sep 17 00:00:00 2001 From: Yixin Shen Date: Fri, 7 Jun 2024 21:50:47 +0800 Subject: [PATCH] ci(lint): update workflows of toolchain and clippy --- .github/workflows/cargo-lint.yml | 61 +++++++++++--------------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/.github/workflows/cargo-lint.yml b/.github/workflows/cargo-lint.yml index c5cb14b..5d3b022 100644 --- a/.github/workflows/cargo-lint.yml +++ b/.github/workflows/cargo-lint.yml @@ -2,14 +2,6 @@ name: Cargo Lint on: push: - branches: - - main - - dev - pull_request: - types: [ready_for_review, opened, synchronize, reopened] - paths: - - '**.rs' - - '**/Cargo.toml' workflow_dispatch: jobs: @@ -20,20 +12,16 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install latest nightly - uses: actions-rs/toolchain@v1 + - name: Install latest stable + uses: dtolnay/rust-toolchain@stable with: toolchain: stable - override: true - components: rustfmt, clippy - # `cargo check` command here will use installed `nightly` - # as it is set as an "override" for current directory - name: deal with rust cache uses: Swatinem/rust-cache@v1 - name: cargo check - run: cargo check --all-targets --workspace + run: cargo check --all-targets --all-features --workspace cargo-build: runs-on: ubuntu-latest @@ -42,20 +30,16 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install latest nightly - uses: actions-rs/toolchain@v1 + - name: Install latest stable + uses: dtolnay/rust-toolchain@stable with: toolchain: stable - override: true - components: rustfmt, clippy - # `cargo check` command here will use installed `nightly` - # as it is set as an "override" for current directory - name: deal with rust cache uses: Swatinem/rust-cache@v1 - name: cargo build - run: cargo build --workspace + run: cargo build --all-features cargo-clippy: runs-on: ubuntu-latest @@ -64,25 +48,23 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install latest nightly - uses: actions-rs/toolchain@v1 + - name: Install latest stable + uses: dtolnay/rust-toolchain@stable with: toolchain: stable - override: true - components: rustfmt, clippy + components: clippy - # `cargo check` command here will use installed `nightly` - # as it is set as an "override" for current directory - name: deal with rust cache uses: Swatinem/rust-cache@v1 + - run: cargo clippy --workspace --all-features --tests -- -Dwarnings - # temporarily change to a self-maintained workflow - # see https://github.com/actions-rs/clippy-check/pull/158 - - name: cargo clippy - uses: BobAnkh/clippy-check@master - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features --workspace + # temporarily change to a self-maintained workflow + # see https://github.com/actions-rs/clippy-check/pull/158 + # - name: cargo clippy + # uses: BobAnkh/clippy-check@master + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # args: --all-targets --all-features --workspace --no-deps cargo-fmt: runs-on: ubuntu-latest @@ -91,15 +73,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install latest nightly - uses: actions-rs/toolchain@v1 + - name: Install latest stable + uses: dtolnay/rust-toolchain@stable with: toolchain: stable - override: true - components: rustfmt, clippy + components: rustfmt - # `cargo check` command here will use installed `nightly` - # as it is set as an "override" for current directory - name: deal with rust cache uses: Swatinem/rust-cache@v1