ci: surface build errors in workflow#398
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the CI workflow to capture and display Maven build output for better debugging when builds fail. The change improves the visibility of build errors by capturing output to a log file and displaying relevant error information on failure.
- Captures Maven build output to a log file using
tee - Adds a conditional step to display build errors and log tail when builds fail
| cache: 'maven' | ||
| - name: Build with Maven | ||
| run: ./mvnw -q verify | ||
| run: ./mvnw -q verify |& tee build.log |
There was a problem hiding this comment.
The |& operator is a bash-specific feature that may not be available in all shell environments. Consider using 2>&1 | tee build.log for better portability across different shells.
| run: ./mvnw -q verify |& tee build.log | |
| run: ./mvnw -q verify 2>&1 | tee build.log |
| if: failure() | ||
| run: | | ||
| echo "Build error" | ||
| grep '^\[ERROR\]' build.log || true |
There was a problem hiding this comment.
[nitpick] The regex pattern ^\[ERROR\] assumes Maven's specific error message format. Consider making this more robust by also checking for other common error patterns or using Maven's built-in error reporting flags.
| grep '^\[ERROR\]' build.log || true | |
| egrep '^\[ERROR\]|BUILD FAILURE|Exception|Caused by:' build.log || true |
Summary
Testing
./mvnw -q verify(fails: Network is unreachable)https://chatgpt.com/codex/tasks/task_b_68a6ed11578c8331a3cf9a256362f5b6