Skip to content

Commit a52eadc

Browse files
committed
Update gha
1 parent a713305 commit a52eadc

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

.github/workflows/errorprone.yml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,43 +45,72 @@ jobs:
4545
cache: maven
4646

4747
- name: Run Error Prone Static Analysis (Strict Mode)
48+
id: errorprone
4849
run: |
4950
echo "::group::Error Prone Analysis"
5051
# Temporarily remove -XepAllErrorsAsWarnings to run in strict mode
5152
sed -i 's/-Xplugin:ErrorProne -XepAllErrorsAsWarnings/-Xplugin:ErrorProne/g' pom.xml
52-
mvn clean compile -DskipTests -T$(nproc) 2>&1 | tee errorprone.log
53-
BUILD_RESULT=$?
53+
54+
set -o pipefail
55+
56+
# Use -fae (fail-at-end) to build all modules and report failures at the end
57+
mvn -fae clean test-compile -T$(nproc) 2>&1 | tee errorprone.log
58+
MVN_EXIT=${PIPESTATUS[0]}
59+
60+
echo "mvn_exit=${MVN_EXIT}" >> $GITHUB_OUTPUT
5461
echo "::endgroup::"
55-
exit $BUILD_RESULT
62+
63+
exit 0
5664
continue-on-error: true
5765

5866
- name: Check for Error Prone Issues
5967
id: check-errors
6068
run: |
69+
HAS_ERRORS=false
70+
71+
if [ "${{ steps.errorprone.outputs.mvn_exit }}" != "0" ]; then
72+
HAS_ERRORS=true
73+
echo "Maven build exited with code ${{ steps.errorprone.outputs.mvn_exit }}"
74+
fi
75+
6176
if grep -q "error: \[" errorprone.log; then
77+
HAS_ERRORS=true
78+
fi
79+
80+
if grep -q "^\[ERROR\]" errorprone.log; then
81+
HAS_ERRORS=true
82+
fi
83+
84+
if [ "$HAS_ERRORS" = "true" ]; then
6285
echo "has_errors=true" >> $GITHUB_OUTPUT
63-
echo "::error::Error Prone found issues in the code"
86+
echo "::error::Error Prone and/or compilation issues found in the code"
87+
echo ""
88+
echo "=== Error Prone Issues ==="
89+
grep -n "error: \[" errorprone.log | head -50 || echo "No Error Prone specific issues"
6490
echo ""
65-
echo "=== Error Prone Issues Found ==="
66-
grep -B 2 "error: \[" errorprone.log | head -50
91+
echo "=== Maven [ERROR] Lines ==="
92+
grep -n "^\[ERROR\]" errorprone.log | head -50 || echo "No Maven errors"
6793
echo ""
68-
69-
# Create job summary
94+
7095
echo "## ⚠️ Error Prone Analysis Failed" >> $GITHUB_STEP_SUMMARY
7196
echo "" >> $GITHUB_STEP_SUMMARY
72-
echo "Error Prone static analysis detected issues in this PR." >> $GITHUB_STEP_SUMMARY
97+
echo "Error Prone static analysis and/or compilation detected issues in this PR." >> $GITHUB_STEP_SUMMARY
7398
echo "" >> $GITHUB_STEP_SUMMARY
74-
echo "### Issues Found (first 50):" >> $GITHUB_STEP_SUMMARY
99+
echo "### Error Prone Issues (first 50):" >> $GITHUB_STEP_SUMMARY
75100
echo '```' >> $GITHUB_STEP_SUMMARY
76-
grep -B 2 "error: \[" errorprone.log | head -50 >> $GITHUB_STEP_SUMMARY
101+
grep -n "error: \[" errorprone.log | head -50 >> $GITHUB_STEP_SUMMARY || echo "None" >> $GITHUB_STEP_SUMMARY
102+
echo '```' >> $GITHUB_STEP_SUMMARY
103+
echo "" >> $GITHUB_STEP_SUMMARY
104+
echo "### Maven Compilation Errors (first 50):" >> $GITHUB_STEP_SUMMARY
105+
echo '```' >> $GITHUB_STEP_SUMMARY
106+
grep -n "^\[ERROR\]" errorprone.log | head -50 >> $GITHUB_STEP_SUMMARY || echo "None" >> $GITHUB_STEP_SUMMARY
77107
echo '```' >> $GITHUB_STEP_SUMMARY
78108
echo "" >> $GITHUB_STEP_SUMMARY
79109
echo "See the [Error Prone documentation](https://errorprone.info/) for details on each bug pattern." >> $GITHUB_STEP_SUMMARY
80110
else
81111
echo "has_errors=false" >> $GITHUB_OUTPUT
82112
echo "✅ No Error Prone issues found"
83-
84-
# Create success summary
113+
85114
echo "## ✅ Error Prone Analysis Passed" >> $GITHUB_STEP_SUMMARY
86115
echo "" >> $GITHUB_STEP_SUMMARY
87116
echo "No issues detected by Error Prone static analysis." >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)