Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Use workflow commands to group output by target #4179

Merged
merged 2 commits into from
Dec 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 28 additions & 15 deletions ci/verify-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ if [ "$TOOLCHAIN" = "nightly" ] ; then
rustup component add rust-src
fi

# Print GHA workflow commands
echo_if_ci() {
# Discard stderr so the "set -x" trace doesn't show up
{ [ -n "${CI:-}" ] && echo "$1"; } 2> /dev/null
}

# Run the tests for a specific target
test_target() {
target="${1}"
no_dist="${2:-0}"
target="$1"
no_dist="$2"

RUSTFLAGS="${RUSTFLAGS:-}"

Expand Down Expand Up @@ -265,7 +271,13 @@ case "$rust" in
*) supports_wasi_pn=0 ;;
esac

for target in $targets; do
some_tests_run=0

# Apply the `FILTER` variable, do OS-specific tasks, and run a target
filter_and_run() {
target="$1"
no_dist="${2:-0}"

if echo "$target" | grep -q "$filter"; then
if [ "$os" = "windows" ]; then
TARGET="$target" ./ci/install-rust.sh
Expand All @@ -278,27 +290,28 @@ for target in $targets; do

# `wasm32-wasip2` only exists in recent versions of Rust
if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then
continue
return
fi

test_target "$target"
test_run=1
test_target "$target" "$no_dist"
some_tests_run=1
fi
}

for target in $targets; do
echo_if_ci "::group::Target: $target"
filter_and_run "$target"
echo_if_ci "::endgroup::"
done

for target in ${no_dist_targets:-}; do
if echo "$target" | grep -q "$filter"; then
if [ "$os" = "windows" ]; then
TARGET="$target" ./ci/install-rust.sh
fi

test_target "$target" 1
test_run=1
fi
echo_if_ci "::group::Target: $target"
filter_and_run "$target" 1
echo_if_ci "::endgroup::"
done

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