Skip to content

Commit d3ac2df

Browse files
authored
Modernize GitHub Actions workflows (#151)
This closes #147. ## Summary - upgrade `actions/checkout` from v4 to v7 and `actions/cache` from v4 to v6 - replace the archived `actions-rs/toolchain` and `actions-rs/cargo` actions with `dtolnay/rust-toolchain` and direct Cargo/Cross commands - fix the two failing i686 clang-cl jobs by using the LLVM toolchain bundled with the Windows runner instead of the removed MSYS2 `mingw-w64-i686-clang` package - remove the deprecated MSYS2 MINGW32/MINGW64 dependency from Windows GNU testing by using the matching Rust GNU host toolchains - add read-only token permissions, stale-run cancellation, consistent timeouts, and a working llvm-mingw cache ## Failure analysis Both failures in [run 30741090730](https://github.com/rust-lang/stacker/actions/runs/30741090730) stop in `msys2/setup-msys2` with `error: target not found: mingw-w64-i686-clang`. MSYS2 phased out its 32-bit environments and removed CLANG32, so the old `C:/msys64/mingw32/bin/clang-cl.exe` setup is no longer maintainable. The replacement uses `C:/Program Files/LLVM/bin/clang-cl.exe`, which is provided by the GitHub-hosted Windows image and supports both MSVC targets. Windows GNU jobs now install the target-specific Rust host toolchain, including the official `rust-mingw` component, instead of relying on legacy MSYS2 environments. ## Validation - `go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 -color .github/workflows/test.yml` - `cargo test --all-targets` - `cargo test --manifest-path psm/Cargo.toml --all-targets` - `git diff --check` - [GitHub Actions run 30741670026](https://github.com/rust-lang/stacker/actions/runs/30741670026): all 201 jobs passed
1 parent cdf19cf commit d3ac2df

1 file changed

Lines changed: 81 additions & 177 deletions

File tree

.github/workflows/test.yml

Lines changed: 81 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,24 @@ on:
1111
types: [opened, reopened, synchronize]
1212
workflow_dispatch:
1313

14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: true
20+
1421
jobs:
1522
psm-msrv-test:
1623
name: Test psm on MSRV
1724
runs-on: ubuntu-latest
25+
timeout-minutes: 10
26+
env:
27+
RUSTUP_TOOLCHAIN: "1.88.0"
1828
steps:
19-
- uses: actions/checkout@v4
20-
- name: Install Rust 1.88.0
21-
uses: actions-rs/toolchain@v1
22-
with:
23-
toolchain: 1.88.0
24-
profile: minimal
25-
default: true
26-
- name: Test psm
27-
uses: actions-rs/cargo@v1
28-
with:
29-
command: test
30-
args: --manifest-path=psm/Cargo.toml --all-targets
29+
- uses: actions/checkout@v7
30+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal
31+
- run: cargo test --manifest-path psm/Cargo.toml --all-targets
3132

3233
native-test:
3334
name: Test ${{ matrix.manifest }} on ${{ matrix.os }} with ${{ matrix.rust_toolchain }} and ${{ matrix.mode }}
@@ -59,79 +60,46 @@ jobs:
5960
timeout-minutes: 10
6061
env:
6162
CFLAGS: ${{ matrix.cflags }}
63+
RUSTUP_TOOLCHAIN: ${{ matrix.rust_toolchain }}
6264
steps:
63-
- uses: actions/checkout@v4
64-
- name: Install Rust ${{ matrix.rust_toolchain }}
65-
uses: actions-rs/toolchain@v1
66-
with:
67-
toolchain: ${{ matrix.rust_toolchain }}
68-
profile: minimal
69-
default: true
70-
target: ${{ matrix.extra_target }}
71-
- name: Test ${{ matrix.manifest}} with ${{ matrix.mode }}
72-
uses: actions-rs/cargo@v1
73-
with:
74-
command: test
75-
args: --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} -- --nocapture
76-
- name: Test ${{ matrix.manifest}} examples with ${{ matrix.mode }}
77-
uses: actions-rs/cargo@v1
78-
with:
79-
command: test
80-
args: --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} --examples -- --nocapture
65+
- uses: actions/checkout@v7
66+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal
8167
- if: ${{ matrix.extra_target }}
82-
name: Test ${{ matrix.manifest}} with ${{ matrix.mode }} as ${{ matrix.extra_target }}
83-
uses: actions-rs/cargo@v1
84-
with:
85-
command: test
86-
args: --target=${{ matrix.extra_target }} --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} -- --nocapture
68+
run: rustup target add --toolchain ${{ env.RUSTUP_TOOLCHAIN }} ${{ matrix.extra_target }}
69+
- run: cargo test --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} -- --nocapture
70+
- run: cargo test --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} --examples -- --nocapture
8771
- if: ${{ matrix.extra_target }}
88-
name: Test ${{ matrix.manifest}} examples with ${{ matrix.mode }} as ${{ matrix.extra_target }}
89-
uses: actions-rs/cargo@v1
90-
with:
91-
command: test
92-
args: --target=${{ matrix.extra_target }} --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} --examples -- --nocapture
72+
run: cargo test --target=${{ matrix.extra_target }} --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} -- --nocapture
73+
- if: ${{ matrix.extra_target }}
74+
run: cargo test --target=${{ matrix.extra_target }} --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} --examples -- --nocapture
9375

9476
clang-cl-test:
95-
name: Test ${{ matrix.manifest }} on ${{ matrix.rust_target }} with ${{ matrix.clang_cl }}
77+
name: Test ${{ matrix.manifest }} on ${{ matrix.rust_target }} with clang-cl
9678
runs-on: windows-latest
79+
timeout-minutes: 10
80+
env:
81+
RUSTUP_TOOLCHAIN: stable
9782
strategy:
9883
fail-fast: false
9984
matrix:
10085
manifest: ["psm/Cargo.toml", "Cargo.toml"]
10186
rust_target:
10287
- x86_64-pc-windows-msvc
103-
# - i686-pc-windows-msvc
104-
include:
105-
- rust_target: x86_64-pc-windows-msvc
106-
clang_cl: C:/msys64/mingw64/bin/clang-cl.exe
107-
package: mingw-w64-x86_64-clang
108-
# mingw has removed the relevant packages
109-
# - rust_target: i686-pc-windows-msvc
110-
# clang_cl: C:/msys64/mingw32/bin/clang-cl.exe
111-
# package: mingw-w64-i686-clang
88+
- i686-pc-windows-msvc
11289
steps:
113-
- uses: actions/checkout@v4
114-
- uses: msys2/setup-msys2@v2
115-
with:
116-
release: false
117-
install: ${{ matrix.package }}
118-
- uses: actions-rs/toolchain@v1
119-
with:
120-
toolchain: stable
121-
profile: minimal
122-
default: true
123-
target: ${{ matrix.rust_target }}
124-
- uses: actions-rs/cargo@v1
125-
with:
126-
command: test
127-
args: --target=${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }} -- --nocapture
90+
- uses: actions/checkout@v7
91+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal --target ${{ matrix.rust_target }}
92+
- run: cargo test --target=${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }} -- --nocapture
12893
env:
129-
CC: ${{ matrix.clang_cl }}
94+
CC: "C:/Program Files/LLVM/bin/clang-cl.exe"
13095
CFLAGS: "-Werror -Wundef"
13196

13297
windows-gnu-test:
13398
name: Test ${{ matrix.manifest }} on ${{ matrix.rust_target }} with ${{ matrix.rust_toolchain }}
13499
runs-on: windows-latest
100+
timeout-minutes: 10
101+
env:
102+
RUSTUP_TOOLCHAIN: ${{ matrix.rust_toolchain }}-${{ matrix.rust_target }}
135103
strategy:
136104
fail-fast: false
137105
matrix:
@@ -140,40 +108,20 @@ jobs:
140108
- x86_64-pc-windows-gnu
141109
- i686-pc-windows-gnu
142110
manifest: ["psm/Cargo.toml", "Cargo.toml"]
143-
include:
144-
- rust_target: x86_64-pc-windows-gnu
145-
mingw_path: C:/msys64/mingw64/bin
146-
package: mingw-w64-x86_64-gcc
147-
- rust_target: i686-pc-windows-gnu
148-
mingw_path: C:/msys64/mingw32/bin
149-
package: mingw-w64-i686-gcc
150111
steps:
151-
- uses: actions/checkout@v4
152-
- uses: msys2/setup-msys2@v2
153-
with:
154-
release: false
155-
install: ${{ matrix.package }}
156-
- run: echo "c:/msys64/bin" | Out-File -FilePath $env:GITHUB_PATH -Append
157-
- run: echo "${{ matrix.mingw_path }}" | Out-File -FilePath $env:GITHUB_PATH -Append
158-
- name: Install Rust
159-
uses: actions-rs/toolchain@v1
160-
with:
161-
toolchain: ${{ matrix.rust_toolchain }}
162-
profile: minimal
163-
target: ${{ matrix.rust_target }}
164-
default: true
165-
- uses: actions-rs/cargo@v1
166-
with:
167-
command: test
168-
args: --target ${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
112+
- uses: actions/checkout@v7
113+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal
114+
- run: cargo test --target ${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
169115
env:
170116
CFLAGS: "-Werror -Wundef"
171117

172118
cross-windows-gnullvm-check:
173119
name: Check ${{ matrix.manifest }} to ${{ matrix.rust_target }} with stable
174120
runs-on: ubuntu-22.04
121+
timeout-minutes: 10
175122
env:
176123
LLVM_MINGW_VERSION: "20250417"
124+
RUSTUP_TOOLCHAIN: stable
177125
strategy:
178126
fail-fast: false
179127
matrix:
@@ -183,27 +131,20 @@ jobs:
183131
- x86_64-pc-windows-gnullvm
184132
manifest: ["psm/Cargo.toml", "Cargo.toml"]
185133
steps:
186-
- uses: actions/checkout@v4
187-
- uses: actions/cache@v4
134+
- uses: actions/checkout@v7
135+
- name: Cache llvm-mingw
136+
id: llvm_mingw_cache
137+
uses: actions/cache@v6
188138
with:
189-
path: llvm-mingw-version
190-
key: ${{ env.LLVM_MINGW_VERSION }}
139+
path: llvm-mingw-${{ env.LLVM_MINGW_VERSION }}-ucrt-ubuntu-22.04-x86_64
140+
key: llvm-mingw-${{ runner.os }}-${{ env.LLVM_MINGW_VERSION }}
191141
- name: Install llvm-mingw
192-
if: steps.cache.outputs.cache-hit != 'true'
142+
if: steps.llvm_mingw_cache.outputs.cache-hit != 'true'
193143
run: curl -L https://github.com/mstorsjo/llvm-mingw/releases/download/${{ env.LLVM_MINGW_VERSION }}/llvm-mingw-${{ env.LLVM_MINGW_VERSION }}-ucrt-ubuntu-22.04-x86_64.tar.xz | tar xJf -
194144
- name: Add llvm-mingw to PATH
195145
run: echo "${{ github.workspace }}/llvm-mingw-${{ env.LLVM_MINGW_VERSION }}-ucrt-ubuntu-22.04-x86_64/bin" >> $GITHUB_PATH
196-
- name: Install Rust
197-
uses: actions-rs/toolchain@v1
198-
with:
199-
toolchain: stable
200-
profile: minimal
201-
target: ${{ matrix.rust_target }}
202-
- name: Check
203-
uses: actions-rs/cargo@v1
204-
with:
205-
command: check
206-
args: --target ${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
146+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal --target ${{ matrix.rust_target }}
147+
- run: cargo check --target ${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
207148

208149
cross-linux-test:
209150
name: Test ${{ matrix.manifest }} on ${{ matrix.rust_target }} with nightly ${{ matrix.mode }}
@@ -234,15 +175,11 @@ jobs:
234175
manifest: ["psm/Cargo.toml", "Cargo.toml"]
235176
mode: ["--release", "-Zminimal-versions", ""]
236177
timeout-minutes: 10
178+
env:
179+
RUSTUP_TOOLCHAIN: nightly
237180
steps:
238-
- uses: actions/checkout@v4
239-
- name: Install Rust
240-
uses: actions-rs/toolchain@v1
241-
with:
242-
toolchain: nightly
243-
profile: minimal
244-
target: ${{ matrix.rust_target }}
245-
default: true
181+
- uses: actions/checkout@v7
182+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal --target ${{ matrix.rust_target }}
246183
- name: Install cross
247184
run: |
248185
cargo install cross --git https://github.com/cross-rs/cross
@@ -262,20 +199,12 @@ jobs:
262199
- x86_64-unknown-freebsd
263200
manifest: ["psm/Cargo.toml", "Cargo.toml"]
264201
timeout-minutes: 10
202+
env:
203+
RUSTUP_TOOLCHAIN: nightly
265204
steps:
266-
- uses: actions/checkout@v4
267-
- name: Install Rust
268-
uses: actions-rs/toolchain@v1
269-
with:
270-
toolchain: nightly
271-
profile: minimal
272-
target: ${{ matrix.rust_target }}
273-
default: true
274-
- name: Build ${{ matrix.rust_target }}
275-
uses: actions-rs/cargo@v1
276-
with:
277-
command: build
278-
args: --target ${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
205+
- uses: actions/checkout@v7
206+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal --target ${{ matrix.rust_target }}
207+
- run: cargo build --target ${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
279208

280209
cross-build:
281210
name: Cross-compile ${{ matrix.manifest }} to ${{ matrix.rust_target }} with cargo-cross
@@ -301,21 +230,14 @@ jobs:
301230
- x86_64-unknown-netbsd
302231
manifest: ["psm/Cargo.toml", "Cargo.toml"]
303232
timeout-minutes: 10
233+
env:
234+
RUSTUP_TOOLCHAIN: nightly
304235
steps:
305-
- uses: actions/checkout@v4
306-
- name: Install Rust nightly
307-
uses: actions-rs/toolchain@v1
308-
with:
309-
toolchain: nightly
310-
profile: minimal
311-
target: ${{ matrix.rust_target }}
312-
default: true
313-
- name: Build ${{ matrix.rust_target }}
314-
uses: actions-rs/cargo@v1
315-
with:
316-
use-cross: true
317-
command: build
318-
args: --target ${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
236+
- uses: actions/checkout@v7
237+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal --target ${{ matrix.rust_target }}
238+
- name: Install cross
239+
run: cargo install cross --git https://github.com/cross-rs/cross
240+
- run: cross build --target ${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
319241

320242
cross-ios-build:
321243
name: Cross-compile ${{ matrix.manifest }} to ${{ matrix.rust_target }} on ${{ matrix.rust_toolchain }}
@@ -329,20 +251,12 @@ jobs:
329251
- x86_64-apple-ios
330252
manifest: ["psm/Cargo.toml", "Cargo.toml"]
331253
timeout-minutes: 10
254+
env:
255+
RUSTUP_TOOLCHAIN: ${{ matrix.rust_toolchain }}
332256
steps:
333-
- uses: actions/checkout@v4
334-
- name: Install Rust
335-
uses: actions-rs/toolchain@v1
336-
with:
337-
toolchain: ${{ matrix.rust_toolchain }}
338-
profile: minimal
339-
target: ${{ matrix.rust_target }}
340-
default: true
341-
- name: Build
342-
uses: actions-rs/cargo@v1
343-
with:
344-
command: build
345-
args: --target=${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
257+
- uses: actions/checkout@v7
258+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal --target ${{ matrix.rust_target }}
259+
- run: cargo build --target=${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
346260

347261
cross-windows-build:
348262
name: Cross-compile ${{ matrix.manifest }} for ${{ matrix.rust_target }} from x86_64-unknown-linux-gnu
@@ -356,14 +270,11 @@ jobs:
356270
manifest: ["psm/Cargo.toml", "Cargo.toml"]
357271
xwin_version: ["0.1.6"]
358272
timeout-minutes: 10
273+
env:
274+
RUSTUP_TOOLCHAIN: stable
359275
steps:
360-
- uses: actions/checkout@v4
361-
- name: Install Rust
362-
uses: actions-rs/toolchain@v1
363-
with:
364-
toolchain: stable
365-
profile: minimal
366-
target: ${{ matrix.rust_target }}
276+
- uses: actions/checkout@v7
277+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal --target ${{ matrix.rust_target }}
367278
- name: Add toolchain shims
368279
run: |
369280
set -eux
@@ -402,14 +313,11 @@ jobs:
402313
name: Test stacker on WASM
403314
runs-on: ubuntu-latest
404315
timeout-minutes: 10
316+
env:
317+
RUSTUP_TOOLCHAIN: nightly
405318
steps:
406-
- uses: actions/checkout@v4
407-
- name: Install Rust nightly
408-
uses: actions-rs/toolchain@v1
409-
with:
410-
toolchain: nightly
411-
default: true
412-
target: wasm32-wasip1
319+
- uses: actions/checkout@v7
320+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal --target wasm32-wasip1
413321
- run: |
414322
curl -Lf https://github.com/bytecodealliance/wasmtime/releases/download/v24.0.0/wasmtime-v24.0.0-x86_64-linux.tar.xz | tar xJf - -C ${{ runner.tool_cache }}
415323
echo "${{ runner.tool_cache }}/wasmtime-v24.0.0-x86_64-linux" >> $GITHUB_PATH
@@ -424,15 +332,11 @@ jobs:
424332
matrix:
425333
os: [ubuntu-latest, windows-latest, macos-latest]
426334
timeout-minutes: 10
335+
env:
336+
RUSTUP_TOOLCHAIN: nightly
427337
steps:
428-
- uses: actions/checkout@v4
429-
- name: Install Rust nightly with Miri
430-
uses: actions-rs/toolchain@v1
431-
with:
432-
toolchain: nightly
433-
profile: minimal
434-
components: miri
435-
default: true
338+
- uses: actions/checkout@v7
339+
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }} --profile minimal --component miri
436340
- name: Setup Miri
437341
run: cargo miri setup
438342
- name: Test with Miri

0 commit comments

Comments
 (0)