generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add annotations to GH on Go test failures
- Loading branch information
1 parent
aeef03a
commit 46990f4
Showing
5 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.gotestsum-1.11.0.pkg |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
fail=0 | ||
if ! gotestsum --format-hide-empty-pkg --junitfile junit-go.xml --junitfile-hide-empty-pkg -- -fullpath ./...; then | ||
fail=1 | ||
fi | ||
|
||
dir="$(pwd)" | ||
yq -oj '.. | select(has("failure")) | .failure["+content"]' junit-go.xml | while read -r failure; do | ||
line="$(echo "$failure" | jq -r | grep -Ee "$dir/.*\.go:\d+" | sed -e "s,^[ ]*$dir/,,")" | ||
file_path=$(echo "$line" | cut -d':' -f1) | ||
line_number=$(echo "$line" | cut -d':' -f2) | ||
# Output the warning message in the format expected by GitHub Actions | ||
echo "::error file=$file_path,line=$line_number::$line" | ||
# $(echo "$failure" | jq -sRr @uri) | ||
done | ||
|
||
exit "$fail" |