From 7679625fd386f1bc0b9bfed6e8b088157881a7fc Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Sat, 7 Feb 2026 18:51:54 -0800 Subject: [PATCH] chore(ci): improve wasm and riscv check output (#21956) Co-authored-by: Amp --- .github/scripts/check_rv32imac.sh | 50 ++++------------------ .github/scripts/check_wasm.sh | 70 ++++++++----------------------- 2 files changed, 26 insertions(+), 94 deletions(-) diff --git a/.github/scripts/check_rv32imac.sh b/.github/scripts/check_rv32imac.sh index 54a05d4e25..dbfbfbf684 100755 --- a/.github/scripts/check_rv32imac.sh +++ b/.github/scripts/check_rv32imac.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash -set +e # Disable immediate exit on error +set -uo pipefail -# Array of crates to check crates_to_check=( reth-codecs-derive reth-primitives @@ -31,51 +30,20 @@ crates_to_check=( reth-stateless ) -# Array to hold the results -results=() -# Flag to track if any command fails any_failed=0 +tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t reth-check) +trap 'rm -rf -- "$tmpdir"' EXIT INT TERM for crate in "${crates_to_check[@]}"; do - cmd="cargo +stable build -p $crate --target riscv32imac-unknown-none-elf --no-default-features" - - if [ -n "$CI" ]; then - echo "::group::$cmd" + outfile="$tmpdir/$crate.log" + if cargo +stable build -p "$crate" --target riscv32imac-unknown-none-elf --no-default-features --color never >"$outfile" 2>&1; then + echo "✅ $crate" else - printf "\n%s:\n %s\n" "$crate" "$cmd" - fi - - set +e # Disable immediate exit on error - # Run the command and capture the return code - $cmd - ret_code=$? - set -e # Re-enable immediate exit on error - - # Store the result in the dictionary - if [ $ret_code -eq 0 ]; then - results+=("1:✅:$crate") - else - results+=("2:❌:$crate") + echo "❌ $crate" + sed 's/^/ /' "$outfile" + echo "" any_failed=1 fi - - if [ -n "$CI" ]; then - echo "::endgroup::" - fi done -# Sort the results by status and then by crate name -IFS=$'\n' sorted_results=($(sort <<<"${results[*]}")) -unset IFS - -# Print summary -echo -e "\nSummary of build results:" -for result in "${sorted_results[@]}"; do - status="${result#*:}" - status="${status%%:*}" - crate="${result##*:}" - echo "$status $crate" -done - -# Exit with a non-zero status if any command fails exit $any_failed diff --git a/.github/scripts/check_wasm.sh b/.github/scripts/check_wasm.sh index e81f88d799..3472ac9e38 100755 --- a/.github/scripts/check_wasm.sh +++ b/.github/scripts/check_wasm.sh @@ -1,11 +1,10 @@ #!/usr/bin/env bash -set +e # Disable immediate exit on error +set -uo pipefail -# Array of crates to compile -crates=($(cargo metadata --format-version=1 --no-deps | jq -r '.packages[].name' | grep '^reth' | sort)) +readarray -t crates < <( + cargo metadata --format-version=1 --no-deps | jq -r '.packages[].name' | grep '^reth' | sort +) -# Array of crates to exclude -# Used with the `contains` function. # shellcheck disable=SC2034 exclude_crates=( # The following require investigation if they can be fixed @@ -77,70 +76,35 @@ exclude_crates=( reth-node-ethstats ) -# Array to hold the results -results=() -# Flag to track if any command fails any_failed=0 +tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t reth-check) +trap 'rm -rf -- "$tmpdir"' EXIT INT TERM -# Function to check if a value exists in an array contains() { local array="$1[@]" - local seeking=$2 - local in=1 + local seeking="$2" + local element for element in "${!array}"; do - if [[ "$element" == "$seeking" ]]; then - in=0 - break - fi + [[ "$element" == "$seeking" ]] && return 0 done - return $in + return 1 } for crate in "${crates[@]}"; do if contains exclude_crates "$crate"; then - results+=("3:⏭️:$crate") + echo "⏭️ $crate" continue fi - cmd="cargo +stable build -p $crate --target wasm32-wasip1 --no-default-features" - - if [ -n "$CI" ]; then - echo "::group::$cmd" + outfile="$tmpdir/$crate.log" + if cargo +stable build -p "$crate" --target wasm32-wasip1 --no-default-features --color never >"$outfile" 2>&1; then + echo "✅ $crate" else - printf "\n%s:\n %s\n" "$crate" "$cmd" - fi - - set +e # Disable immediate exit on error - # Run the command and capture the return code - $cmd - ret_code=$? - set -e # Re-enable immediate exit on error - - # Store the result in the dictionary - if [ $ret_code -eq 0 ]; then - results+=("1:✅:$crate") - else - results+=("2:❌:$crate") + echo "❌ $crate" + sed 's/^/ /' "$outfile" + echo "" any_failed=1 fi - - if [ -n "$CI" ]; then - echo "::endgroup::" - fi done -# Sort the results by status and then by crate name -IFS=$'\n' sorted_results=($(sort <<<"${results[*]}")) -unset IFS - -# Print summary -echo -e "\nSummary of build results:" -for result in "${sorted_results[@]}"; do - status="${result#*:}" - status="${status%%:*}" - crate="${result##*:}" - echo "$status $crate" -done - -# Exit with a non-zero status if any command fails exit $any_failed