Skip to content

Commit

Permalink
ci(lint): update workflows of toolchain and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
BobAnkh authored Jun 7, 2024
1 parent 8563baf commit 16c7834
Showing 1 changed file with 20 additions and 41 deletions.
61 changes: 20 additions & 41 deletions .github/workflows/cargo-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 16c7834

Please sign in to comment.