diff --git a/.github/workflows/rust-ci-full.yml b/.github/workflows/rust-ci-full.yml index 188f94ef45..b353f578bc 100644 --- a/.github/workflows/rust-ci-full.yml +++ b/.github/workflows/rust-ci-full.yml @@ -85,7 +85,7 @@ jobs: run: python3 -m unittest discover -s tools/argument-comment-lint -p 'test_*.py' - name: Test argument comment lint package working-directory: tools/argument-comment-lint - run: cargo test + run: bash ./test-with-clippy-compat.sh env: RUST_MIN_STACK: "8388608" # 8 MiB diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 48bee976c9..101b126107 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -153,7 +153,7 @@ jobs: run: python3 -m unittest discover -s tools/argument-comment-lint -p 'test_*.py' - name: Test argument comment lint package working-directory: tools/argument-comment-lint - run: cargo test + run: bash ./test-with-clippy-compat.sh env: RUST_MIN_STACK: "8388608" # 8 MiB diff --git a/tools/argument-comment-lint/test-with-clippy-compat.sh b/tools/argument-comment-lint/test-with-clippy-compat.sh new file mode 100644 index 0000000000..9305b04ae2 --- /dev/null +++ b/tools/argument-comment-lint/test-with-clippy-compat.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Dylint 6.1.0 still checks out rust-clippy's removed master branch. Add an +# alias only to that clone until we upgrade to a Dylint version that uses main. +clippy_config="$(mktemp)" +trap 'rm -f -- "$clippy_config"' EXIT +git config --file "$clippy_config" remote.origin.fetch '+refs/heads/main:refs/heads/master' + +config_index="${GIT_CONFIG_COUNT:-0}" +export "GIT_CONFIG_KEY_${config_index}=includeIf.hasconfig:remote.*.url:https://github.com/rust-lang/rust-clippy.path" +export "GIT_CONFIG_VALUE_${config_index}=$clippy_config" +GIT_CONFIG_COUNT="$((config_index + 1))" cargo test "$@"