@@ -28,10 +28,16 @@ if [ "$TOOLCHAIN" = "nightly" ] ; then
28
28
rustup component add rust-src
29
29
fi
30
30
31
+ # Print GHA workflow commands
32
+ echo_if_ci () {
33
+ # Discard stderr so the "set -x" trace doesn't show up
34
+ { [ -n " ${CI:- } " ] && echo " $1 " ; } 2> /dev/null
35
+ }
36
+
31
37
# Run the tests for a specific target
32
38
test_target () {
33
- target=" ${1} "
34
- no_dist=" ${2 :- 0} "
39
+ target=" $1 "
40
+ no_dist=" $2 "
35
41
36
42
RUSTFLAGS=" ${RUSTFLAGS:- } "
37
43
@@ -265,7 +271,13 @@ case "$rust" in
265
271
* ) supports_wasi_pn=0 ;;
266
272
esac
267
273
268
- for target in $targets ; do
274
+ some_tests_run=0
275
+
276
+ # Apply the `FILTER` variable, do OS-specific tasks, and run a target
277
+ filter_and_run () {
278
+ target=" $1 "
279
+ no_dist=" ${2:- 0} "
280
+
269
281
if echo " $target " | grep -q " $filter " ; then
270
282
if [ " $os " = " windows" ]; then
271
283
TARGET=" $target " ./ci/install-rust.sh
@@ -278,27 +290,28 @@ for target in $targets; do
278
290
279
291
# `wasm32-wasip2` only exists in recent versions of Rust
280
292
if [ " $target " = " wasm32-wasip2" ] && [ " $supports_wasi_pn " = " 0" ]; then
281
- continue
293
+ return
282
294
fi
283
295
284
- test_target " $target "
285
- test_run =1
296
+ test_target " $target " " $no_dist "
297
+ some_tests_run =1
286
298
fi
299
+ }
300
+
301
+ for target in $targets ; do
302
+ echo_if_ci " ::group::Target: $target "
303
+ filter_and_run " $target "
304
+ echo_if_ci " ::endgroup::"
287
305
done
288
306
289
307
for target in ${no_dist_targets:- } ; do
290
- if echo " $target " | grep -q " $filter " ; then
291
- if [ " $os " = " windows" ]; then
292
- TARGET=" $target " ./ci/install-rust.sh
293
- fi
294
-
295
- test_target " $target " 1
296
- test_run=1
297
- fi
308
+ echo_if_ci " ::group::Target: $target "
309
+ filter_and_run " $target " 1
310
+ echo_if_ci " ::endgroup::"
298
311
done
299
312
300
313
# Make sure we didn't accidentally filter everything
301
- if [ " ${test_run :- } " != 1 ]; then
314
+ if [ " $some_tests_run " != 1 ]; then
302
315
echo " No tests were run"
303
316
exit 1
304
317
fi
0 commit comments