Skip to content

Commit 8157b67

Browse files
authored
Report test results to BuildKite (#2075)
* Use gotestsum * Report test runs * Fix tests * Kick GitHub Actions
1 parent fa985d0 commit 8157b67

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@ jobs:
3636
with:
3737
go-version: '1.19'
3838

39+
- name: gotestsum
40+
run: go install gotest.tools/gotestsum@latest
41+
3942
- name: install ./...
4043
run: go install ./...
4144

4245
- name: test ./...
43-
run: go test --tags=examples ./...
46+
run: gotestsum --junitfile junit.xml -- --tags=examples ./...
4447
env:
4548
PG_USER: postgres
4649
PG_HOST: localhost
@@ -55,3 +58,8 @@ jobs:
5558
- name: build internal/endtoend
5659
run: go build ./...
5760
working-directory: internal/endtoend/testdata
61+
62+
- name: report
63+
run: ./scripts/report.sh
64+
env:
65+
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }}

scripts/report.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
curl \
4+
-X POST \
5+
--fail-with-body \
6+
-H "Authorization: Token token=\"$BUILDKITE_ANALYTICS_TOKEN\"" \
7+
8+
-F "format=junit" \
9+
-F "run_env[CI]=buildkite" \
10+
-F "run_env[key]=$GITHUB_RUN_ID" \
11+
-F "run_env[number]=$GITHUB_RUN_NUMBER-$GITHUB_RUN_ATTEMPT" \
12+
-F "run_env[job_id]=$GITHUB_RUN_ID" \
13+
-F "run_env[branch]=$GITHUB_REF" \
14+
-F "run_env[commit_sha]=$GITHUB_SHA" \
15+
-F "run_env[message]=Foo" \
16+
-F "run_env[url]=$GITHUB_SERVER_URL" \
17+
https://analytics-api.buildkite.com/v1/uploads

0 commit comments

Comments
 (0)