Skip to content

Commit 4ef9177

Browse files
authored
CI: be compatible with both Rustup pre-1.28.0 and 1.28.0 (#13944)
`rustup show active-toolchain` will no longer install the default toolchain starting from Rustup 1.28.0, and `rustup toolchain install` without extra arguments is not supported in Rustup pre-1.28.0. The Rustup change and proposed solution is described in <https://internals.rust-lang.org/t/seeking-beta-testers-for-rustup-v1-28-0/22060>. changelog: none
2 parents d0d5b8a + 12d3137 commit 4ef9177

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.github/workflows/clippy_mq.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ jobs:
7878
- name: Install toolchain
7979
run: |
8080
rustup set default-host ${{ matrix.host }}
81-
rustup show active-toolchain
81+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
82+
rustup show active-toolchain || rustup toolchain install
8283
8384
# Run
8485
- name: Build
@@ -129,7 +130,9 @@ jobs:
129130
persist-credentials: false
130131

131132
- name: Install toolchain
132-
run: rustup show active-toolchain
133+
run: |
134+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
135+
rustup show active-toolchain || rustup toolchain install
133136
134137
- name: Test metadata collection
135138
run: cargo collect-metadata
@@ -146,7 +149,9 @@ jobs:
146149
persist-credentials: false
147150

148151
- name: Install toolchain
149-
run: rustup show active-toolchain
152+
run: |
153+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
154+
rustup show active-toolchain || rustup toolchain install
150155
151156
# Run
152157
- name: Build Integration Test
@@ -200,7 +205,9 @@ jobs:
200205
persist-credentials: false
201206

202207
- name: Install toolchain
203-
run: rustup show active-toolchain
208+
run: |
209+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
210+
rustup show active-toolchain || rustup toolchain install
204211
205212
# Download
206213
- name: Download target dir
@@ -215,7 +222,7 @@ jobs:
215222
# Run
216223
- name: Test ${{ matrix.integration }}
217224
run: |
218-
TOOLCHAIN=$(rustup show active-toolchain | cut -f1 -d' ')
225+
TOOLCHAIN=$(rustup show active-toolchain | head -n 1 | cut -f1 -d' ')
219226
rustup run $TOOLCHAIN $CARGO_TARGET_DIR/debug/integration --show-output
220227
env:
221228
INTEGRATION: ${{ matrix.integration }}

.github/workflows/clippy_pr.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ jobs:
3030
persist-credentials: false
3131

3232
- name: Install toolchain
33-
run: rustup show active-toolchain
33+
run: |
34+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
35+
rustup show active-toolchain || rustup toolchain install
3436
3537
# Run
3638
- name: Build

0 commit comments

Comments
 (0)