dev/ci: annotate failures with test summary (#32183)

This commit is contained in:
Robert Lin 2022-03-03 18:31:40 -08:00 committed by GitHub
parent 9498a8bd33
commit 46942ea16b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,26 @@
anyStyle:
hide: true
# Style of the "Start" lines.
startStyle:
hide: true
# Style of the "Pass" lines.
passStyle:
hide: true
# Style of the "Skip" lines.
skipStyle:
hide: true
# Style of the "Pass" package lines.
passPackageStyle:
hide: true
# Style of the "Cover" lines with the coverage that is higher than coverThreshold.
coveredStyle:
hide: true
# Style of the "Cover" lines with the coverage that is lower than coverThreshold.
uncoveredStyle:
hide: true

View File

@ -38,6 +38,18 @@ function go_test() {
mkdir -p './test-reports'
go-junit-report <"$tmpfile" >>./test-reports/go-test-junit.xml
# Create annotation from test failure
if [ "$test_exit_code" -ne 0 ]; then
set -x
echo "~~~ Creating test failures anotation"
RICHGO_CONFIG="./.richstyle.yml"
cp "./dev/ci/go-test-failures.richstyle.yml" $RICHGO_CONFIG
mkdir -p ./annotations
richgo testfilter <"$tmpfile" >>./annotations/go-test
rm -rf RICHGO_CONFIG
set +x
fi
return "$test_exit_code"
}
@ -77,7 +89,8 @@ export DB_STARTUP_TIMEOUT=360s # codeinsights-db needs more time to start in som
export NO_GRAPHQL_LOG=true
# Install richgo for better output
go install github.com/kyoh86/richgo@latest
# This fork gives us the `anyStyle` configuration required to hide log lines
go install github.com/jhchabran/richgo@installable
asdf reshim golang
# Used to ignore directories (for example, when using submodules)

View File

@ -343,6 +343,7 @@ func addGoTests(pipeline *bk.Pipeline) {
pipeline.AddStep(
fmt.Sprintf(":go: Test (%s)", description),
bk.AnnotatedCmd("./dev/ci/go-test.sh "+testSuffix, bk.AnnotatedCmdOpts{
Annotations: &bk.AnnotationOpts{},
TestReports: &bk.TestReportOpts{
TestSuiteKeyVariableName: "BUILDKITE_ANALYTICS_BACKEND_TEST_SUITE_API_KEY",
},