From 6024539c1267f5fa6b340caee3c7d43ae5b4e615 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 11 Oct 2025 14:54:56 +0200 Subject: [PATCH] CI lint: consolidate clippy definitions --- .github/actions/rust-toolchain/action.yml | 41 +++++++++++++++++++ .../action.yml | 5 ++- .../actions/rust-toolchain@stable/action.yml | 3 +- .github/workflows/lint.yml | 26 +++++------- 4 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 .github/actions/rust-toolchain/action.yml diff --git a/.github/actions/rust-toolchain/action.yml b/.github/actions/rust-toolchain/action.yml new file mode 100644 index 000000000..7aab17f47 --- /dev/null +++ b/.github/actions/rust-toolchain/action.yml @@ -0,0 +1,41 @@ +name: Rust Toolchain + +inputs: + toolchain_channel: + description: Either "stable" or "msrv" + required: true + targets: + description: Comma-separated list of target triples to install for this toolchain + required: false + components: + description: Comma-separated list of components to be additionally installed + required: false + +permissions: + contents: read + +runs: + using: "composite" + steps: + - name: Set toolchain + env: + toolchain_channel: ${{ inputs.toolchain_channel }} + shell: bash + run: | + set -x + toolchain=$( + case "$toolchain_channel" in + (stable) echo 1.90 ;; + (msrv) echo 1.70 ;; + (*) + printf >&2 "error: unsupported toolchain channel %s" "$toolchain_channel" + exit 1 + ;; + esac + ) + printf 'TOOLCHAIN=%s\n' "$toolchain" >>"$GITHUB_ENV" + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.TOOLCHAIN }} + targets: ${{ inputs.targets }} + components: ${{ inputs.components }} diff --git a/.github/actions/rust-toolchain@oldest-supported/action.yml b/.github/actions/rust-toolchain@oldest-supported/action.yml index 5bde7cf45..ad6fcf418 100644 --- a/.github/actions/rust-toolchain@oldest-supported/action.yml +++ b/.github/actions/rust-toolchain@oldest-supported/action.yml @@ -14,7 +14,8 @@ permissions: runs: using: "composite" steps: - - uses: dtolnay/rust-toolchain@1.70 + - uses: ./.github/actions/rust-toolchain with: + toolchain_channel: "msrv" targets: ${{ inputs.targets }} - components: ${{ inputs.components}} + components: ${{ inputs.components }} diff --git a/.github/actions/rust-toolchain@stable/action.yml b/.github/actions/rust-toolchain@stable/action.yml index ef22dfd3a..a28bcd360 100644 --- a/.github/actions/rust-toolchain@stable/action.yml +++ b/.github/actions/rust-toolchain@stable/action.yml @@ -14,7 +14,8 @@ permissions: runs: using: "composite" steps: - - uses: dtolnay/rust-toolchain@1.90 + - uses: ./.github/actions/rust-toolchain with: + toolchain_channel: "stable" targets: ${{ inputs.targets }} components: ${{ inputs.components }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e3cbb4e40..8f424e08c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,15 +20,22 @@ jobs: - name: check format run: PATH="target/debug:$PATH" build_tools/style.fish --all --check - clippy-stable: + clippy: runs-on: ubuntu-latest strategy: matrix: - features: ["", "--no-default-features"] + include: + - rust_version: "stable" + features: "" + - rust_version: "stable" + features: "--no-default-features" + - rust_version: "msrv" + features: "" steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/rust-toolchain@stable + - uses: ./.github/actions/rust-toolchain with: + toolchain_channel: ${{ matrix.rust_version }} components: clippy - name: Install deps run: | @@ -36,19 +43,6 @@ jobs: - name: cargo clippy run: cargo clippy --workspace --all-targets ${{ matrix.features }} -- --deny=warnings - clippy-msrv: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/rust-toolchain@oldest-supported - with: - components: clippy - - name: Install deps - run: | - sudo apt install gettext - - name: cargo clippy - run: cargo clippy --workspace --all-targets -- --deny=warnings - rustdoc: runs-on: ubuntu-latest steps: