diff --git a/docs/examples/bootstrap.sh b/docs/examples/bootstrap.sh index c3d91f209838..c3ae9f6524b7 100755 --- a/docs/examples/bootstrap.sh +++ b/docs/examples/bootstrap.sh @@ -96,20 +96,31 @@ function compile-solidity { mkdir -p "$OUTPUT_DIR" - # Compile using the local foundry.toml with proper remappings + # Compile using the local foundry.toml with proper remappings. + # forge fetches solc from binaries.soliditylang.org on first use; transient + # DNS/TLS failures there have silently produced partial builds in CI (the loop + # kept going and compile-solidity returned success while an example's artifacts + # were never written). Wrap each forge build in ci3/retry and propagate any + # per-subdir failure so run_step retries the whole step. ( cd "$SOLIDITY_DIR" for subdir in */; do if [ -d "$subdir" ] && ls "$subdir"/*.sol >/dev/null 2>&1; then local subdir_name=$(basename "$subdir") echo_stderr "Compiling $subdir_name..." - forge build \ - --contracts "$subdir" \ - --out "$OUTPUT_DIR/$subdir_name" \ - --no-cache + if ! retry "forge build --contracts $subdir --out $OUTPUT_DIR/$subdir_name --no-cache"; then + echo "$subdir_name" >> "$OUTPUT_DIR/.failed" + fi fi done ) + if [ -f "$OUTPUT_DIR/.failed" ]; then + local failed_subdirs=() + while IFS= read -r name; do failed_subdirs+=("$name"); done < "$OUTPUT_DIR/.failed" + rm -f "$OUTPUT_DIR/.failed" + echo_stderr "ERROR: Solidity compilation failed for: ${failed_subdirs[*]}" + return 1 + fi echo_stderr "Solidity artifacts written to $OUTPUT_DIR" }