mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:51:50 +00:00
dev/ci: annotate failures with test summary (#32183)
This commit is contained in:
parent
9498a8bd33
commit
46942ea16b
26
dev/ci/go-test-failures.richstyle.yml
Normal file
26
dev/ci/go-test-failures.richstyle.yml
Normal 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
|
||||
@ -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)
|
||||
|
||||
@ -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",
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user