Skip to content

Commit 295ed0b

Browse files
committed
Switch CI from bors to merge queue
1 parent 5873cb9 commit 295ed0b

File tree

9 files changed

+283
-344
lines changed

9 files changed

+283
-344
lines changed

.github/workflows/clippy.yml

Lines changed: 182 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
name: Clippy Test
1+
name: Clippy Test (merge queue)
22

33
on:
4-
push:
5-
# Ignore bors branches, since they are covered by `clippy_bors.yml`
6-
branches-ignore:
7-
- auto
8-
- try
9-
# Don't run Clippy tests, when only text files were modified
10-
paths-ignore:
11-
- 'COPYRIGHT'
12-
- 'LICENSE-*'
13-
- '**.md'
14-
- '**.txt'
15-
pull_request:
16-
# Don't run Clippy tests, when only text files were modified
17-
paths-ignore:
18-
- 'COPYRIGHT'
19-
- 'LICENSE-*'
20-
- '**.md'
21-
- '**.txt'
4+
merge_group:
225

236
env:
247
RUST_BACKTRACE: 1
@@ -27,32 +10,84 @@ env:
2710
CARGO_INCREMENTAL: 0
2811
RUSTFLAGS: -D warnings
2912

30-
concurrency:
31-
# For a given workflow, if we push to the same PR, cancel all previous builds on that PR.
32-
# If the push is not attached to a PR, we will cancel all builds on the same branch.
33-
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
34-
cancel-in-progress: true
13+
defaults:
14+
run:
15+
shell: bash
3516

3617
jobs:
37-
base:
38-
# NOTE: If you modify this job, make sure you copy the changes to clippy_bors.yml
18+
changelog:
3919
runs-on: ubuntu-latest
4020

21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.ref }}
26+
27+
# Run
28+
- name: Check Changelog
29+
run: |
30+
MESSAGE=$(git log --format=%B -n 1)
31+
PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
32+
body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
33+
python -c "import sys, json; print(json.load(sys.stdin)['body'])")
34+
output=$(grep "^changelog:\s*\S" <<< "$body" | sed "s/changelog:\s*//g") || {
35+
echo "ERROR: PR body must contain 'changelog: ...'"
36+
exit 1
37+
}
38+
if [[ "$output" = "none" ]]; then
39+
echo "WARNING: changelog is 'none'"
40+
else
41+
echo "changelog: $output"
42+
fi
43+
env:
44+
PYTHONIOENCODING: 'utf-8'
45+
base:
46+
needs: changelog
47+
strategy:
48+
matrix:
49+
include:
50+
- os: ubuntu-latest
51+
host: x86_64-unknown-linux-gnu
52+
- os: ubuntu-latest
53+
host: i686-unknown-linux-gnu
54+
- os: windows-latest
55+
host: x86_64-pc-windows-msvc
56+
- os: macos-13
57+
host: x86_64-apple-darwin
58+
59+
runs-on: ${{ matrix.os }}
60+
61+
# NOTE: If you modify this job, make sure you copy the changes to clippy.yml
4162
steps:
4263
# Setup
4364
- name: Checkout
4465
uses: actions/checkout@v4
4566

67+
- name: Install i686 dependencies
68+
if: matrix.host == 'i686-unknown-linux-gnu'
69+
run: |
70+
sudo dpkg --add-architecture i386
71+
sudo apt-get update
72+
sudo apt-get install gcc-multilib zlib1g-dev:i386
73+
4674
- name: Install toolchain
47-
run: rustup show active-toolchain
75+
run: |
76+
rustup set default-host ${{ matrix.host }}
77+
rustup show active-toolchain
4878
4979
# Run
5080
- name: Build
5181
run: cargo build --tests --features internal
5282

5383
- name: Test
84+
if: matrix.host == 'x86_64-unknown-linux-gnu'
5485
run: cargo test --features internal
5586

87+
- name: Test
88+
if: matrix.host != 'x86_64-unknown-linux-gnu'
89+
run: cargo test --features internal -- --skip dogfood
90+
5691
- name: Test clippy_lints
5792
run: cargo test --features internal
5893
working-directory: clippy_lints
@@ -61,6 +96,10 @@ jobs:
6196
run: cargo test
6297
working-directory: clippy_utils
6398

99+
- name: Test clippy_config
100+
run: cargo test
101+
working-directory: clippy_config
102+
64103
- name: Test rustc_tools_util
65104
run: cargo test
66105
working-directory: rustc_tools_util
@@ -73,3 +112,119 @@ jobs:
73112
run: .github/driver.sh
74113
env:
75114
OS: ${{ runner.os }}
115+
116+
metadata_collection:
117+
needs: changelog
118+
runs-on: ubuntu-latest
119+
120+
steps:
121+
# Setup
122+
- name: Checkout
123+
uses: actions/checkout@v4
124+
125+
- name: Install toolchain
126+
run: rustup show active-toolchain
127+
128+
- name: Test metadata collection
129+
run: cargo collect-metadata
130+
131+
integration_build:
132+
needs: changelog
133+
runs-on: ubuntu-latest
134+
135+
steps:
136+
# Setup
137+
- name: Checkout
138+
uses: actions/checkout@v4
139+
140+
- name: Install toolchain
141+
run: rustup show active-toolchain
142+
143+
# Run
144+
- name: Build Integration Test
145+
env:
146+
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: off
147+
run: cargo test --test integration --features integration --no-run
148+
149+
# Upload
150+
- name: Extract Binaries
151+
run: |
152+
DIR=$CARGO_TARGET_DIR/debug
153+
find $DIR/deps/integration-* -executable ! -type d | xargs -I {} mv {} $DIR/integration
154+
find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
155+
156+
- name: Upload Binaries
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: binaries
160+
path: target/debug
161+
162+
integration:
163+
needs: integration_build
164+
strategy:
165+
fail-fast: false
166+
max-parallel: 6
167+
matrix:
168+
integration:
169+
- 'matthiaskrgr/clippy_ci_panic_test'
170+
- 'rust-lang/cargo'
171+
- 'rust-lang/chalk'
172+
- 'rust-lang/rustfmt'
173+
- 'Marwes/combine'
174+
- 'Geal/nom'
175+
- 'rust-lang/stdarch'
176+
- 'serde-rs/serde'
177+
- 'chronotope/chrono'
178+
- 'hyperium/hyper'
179+
- 'rust-random/rand'
180+
- 'rust-lang/futures-rs'
181+
- 'rust-itertools/itertools'
182+
- 'rust-lang-nursery/failure'
183+
- 'rust-lang/log'
184+
185+
runs-on: ubuntu-latest
186+
187+
steps:
188+
# Setup
189+
- name: Checkout
190+
uses: actions/checkout@v4
191+
192+
- name: Install toolchain
193+
run: rustup show active-toolchain
194+
195+
# Download
196+
- name: Download target dir
197+
uses: actions/download-artifact@v4
198+
with:
199+
name: binaries
200+
path: target/debug
201+
202+
- name: Make Binaries Executable
203+
run: chmod +x $CARGO_TARGET_DIR/debug/*
204+
205+
# Run
206+
- name: Test ${{ matrix.integration }}
207+
run: |
208+
TOOLCHAIN=$(rustup show active-toolchain | cut -f1 -d' ')
209+
rustup run $TOOLCHAIN $CARGO_TARGET_DIR/debug/integration --show-output
210+
env:
211+
INTEGRATION: ${{ matrix.integration }}
212+
213+
conclusion:
214+
needs: [ changelog, base, metadata_collection, integration_build, integration ]
215+
# We need to ensure this job does *not* get skipped if its dependencies fail,
216+
# because a skipped job is considered a success by GitHub. So we have to
217+
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
218+
# when the workflow is canceled manually.
219+
#
220+
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
221+
if: ${{ !cancelled() }}
222+
runs-on: ubuntu-latest
223+
steps:
224+
# Manually check the status of all dependencies. `if: failure()` does not work.
225+
- name: Conclusion
226+
run: |
227+
# Print the dependent jobs to see them in the CI log
228+
jq -C <<< '${{ toJson(needs) }}'
229+
# Check if all jobs that we depend on (in the needs array) were successful.
230+
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

0 commit comments

Comments
 (0)