@@ -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
@@ -269,7 +275,13 @@ case "$rust" in
269
275
* ) supports_wasi_pn=0 ;;
270
276
esac
271
277
272
- for target in $targets ; do
278
+ some_tests_run=0
279
+
280
+ # Apply the `FILTER` variable, do OS-specific tasks, and run a target
281
+ filter_and_run () {
282
+ target=" $1 "
283
+ no_dist=" ${2:- 0} "
284
+
273
285
if echo " $target " | grep -q " $filter " ; then
274
286
if [ " $os " = " windows" ]; then
275
287
TARGET=" $target " ./ci/install-rust.sh
@@ -282,27 +294,28 @@ for target in $targets; do
282
294
283
295
# `wasm32-wasip2` only exists in recent versions of Rust
284
296
if [ " $target " = " wasm32-wasip2" ] && [ " $supports_wasi_pn " = " 0" ]; then
285
- continue
297
+ return
286
298
fi
287
299
288
- test_target " $target "
289
- test_run =1
300
+ test_target " $target " " $no_dist "
301
+ some_tests_run =1
290
302
fi
303
+ }
304
+
305
+ for target in $targets ; do
306
+ echo_if_ci " ::group::Target: $target "
307
+ filter_and_run " $target "
308
+ echo_if_ci " ::endgroup::"
291
309
done
292
310
293
311
for target in ${no_dist_targets:- } ; do
294
- if echo " $target " | grep -q " $filter " ; then
295
- if [ " $os " = " windows" ]; then
296
- TARGET=" $target " ./ci/install-rust.sh
297
- fi
298
-
299
- test_target " $target " 1
300
- test_run=1
301
- fi
312
+ echo_if_ci " ::group::Target: $target "
313
+ filter_and_run " $target " 1
314
+ echo_if_ci " ::endgroup::"
302
315
done
303
316
304
317
# Make sure we didn't accidentally filter everything
305
- if [ " ${test_run :- } " != 1 ]; then
318
+ if [ " $some_tests_run " != 1 ]; then
306
319
echo " No tests were run"
307
320
exit 1
308
321
fi
0 commit comments