Created
July 5, 2024 08:25
-
-
Save krissrex/2c7ee9237957ec37b1f4daf00db9932c to your computer and use it in GitHub Desktop.
Maven Surefire and Failsafe errors to GitHub Actions Summary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#- name: build and test | |
# do mvn verify here | |
- name: show errors | |
if: ${{ failure() }} | |
env: | |
FAILS_FILE: ${{ runner.temp }}/fails.txt | |
run: | | |
echo '## Build failure ' >> $GITHUB_STEP_SUMMARY | |
{ find . -type f -path '*target/surefire-reports/*.txt' -exec grep -l -E '(Failures: [^0]|Errors: [^0])' {} >> "${FAILS_FILE}" \; || :; } | |
{ find . -type f -path '*target/failsafe-reports/*.txt' -exec grep -l -E '(Failures: [^0]|Errors: [^0])' {} >> "${FAILS_FILE}" \; || :; } | |
while IFS="" read -r errorFile || [ -n "$errorFile" ]; do | |
echo "**${errorFile}** " >> $GITHUB_STEP_SUMMARY | |
echo '```text' >> $GITHUB_STEP_SUMMARY | |
cat "${errorFile}" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
echo '---' >> $GITHUB_STEP_SUMMARY | |
done < "${FAILS_FILE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment