Skip to content

Commit 496d606

Browse files
committed
Fix: update pipeline for verbose errors
1 parent 36c1b93 commit 496d606

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

.github/workflows/build-pull-request.yml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,30 +129,36 @@ jobs:
129129
cd ./${{ matrix.language }}
130130
131131
# Run the build_file function in parallel for each project to be built
132-
# Halt the execution if any of the build_file invocations fail
133132
echo "::group::Build Output"
134133
echo "Starting builds for all projects..."
135-
# Use --line-buffer to ensure output is displayed immediately
136-
# Use --verbose to show which command is being executed
137-
# Remove --halt-on-error to ensure all errors are displayed
138-
parallel --keep-order --line-buffer --verbose build_file ::: "${apps_to_build[@]}" || true
139134
140-
# Check for any failed builds by examining the log files
141-
echo "Checking for build failures..."
142-
failed_builds=()
143-
for log_file in /tmp/build_logs/*.log; do
144-
if grep -q "Build failed" "$log_file"; then
145-
project=$(basename "$log_file" .log | sed 's/_/\//g')
146-
failed_builds+=("$project")
147-
echo "::error::Build failed for $project"
148-
echo "--- Error output for $project ---"
149-
cat "$log_file"
135+
# Create an array to track build results
136+
declare -A build_results
137+
138+
# Run builds one by one to ensure we capture all output
139+
for app in "${apps_to_build[@]}"; do
140+
echo "::group::Building $app"
141+
build_file "$app"
142+
build_exit=$?
143+
144+
# Store the result
145+
if [ $build_exit -ne 0 ]; then
146+
build_results["$app"]=$build_exit
147+
echo "::error::Build failed for $app with exit code $build_exit"
148+
echo "--- Error output from log ---"
149+
cat "/tmp/build_logs/$(basename "$app" | sed 's/\//_/g').log"
150150
echo "--- End of error output ---"
151151
fi
152+
echo "::endgroup::"
152153
done
153154
echo "::endgroup::"
154-
155+
155156
# Check if any builds failed
157+
failed_builds=()
158+
for app in "${!build_results[@]}"; do
159+
failed_builds+=("$app")
160+
done
161+
156162
if [ ${#failed_builds[@]} -gt 0 ]; then
157163
echo "::error::The following builds failed: ${failed_builds[*]}"
158164
parallel_exit=1

0 commit comments

Comments
 (0)