Skip to content

Commit fc3234f

Browse files
authored
Merge pull request #4179 from tgross35/ci-group-lines
ci: Use workflow commands to group output by target
2 parents 5f6c5b0 + 5b471ae commit fc3234f

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

ci/verify-build.sh

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@ if [ "$TOOLCHAIN" = "nightly" ] ; then
2828
rustup component add rust-src
2929
fi
3030

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+
3137
# Run the tests for a specific target
3238
test_target() {
33-
target="${1}"
34-
no_dist="${2:-0}"
39+
target="$1"
40+
no_dist="$2"
3541

3642
RUSTFLAGS="${RUSTFLAGS:-}"
3743

@@ -265,7 +271,13 @@ case "$rust" in
265271
*) supports_wasi_pn=0 ;;
266272
esac
267273

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+
269281
if echo "$target" | grep -q "$filter"; then
270282
if [ "$os" = "windows" ]; then
271283
TARGET="$target" ./ci/install-rust.sh
@@ -278,27 +290,28 @@ for target in $targets; do
278290

279291
# `wasm32-wasip2` only exists in recent versions of Rust
280292
if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then
281-
continue
293+
return
282294
fi
283295

284-
test_target "$target"
285-
test_run=1
296+
test_target "$target" "$no_dist"
297+
some_tests_run=1
286298
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::"
287305
done
288306

289307
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::"
298311
done
299312

300313
# Make sure we didn't accidentally filter everything
301-
if [ "${test_run:-}" != 1 ]; then
314+
if [ "$some_tests_run" != 1 ]; then
302315
echo "No tests were run"
303316
exit 1
304317
fi

0 commit comments

Comments
 (0)