forked from signalfx/signalfx-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.53 KB
/
go-test-race.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: go-test-race
on:
push:
branches:
- main
pull_request:
concurrency:
group: go-test-race-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
RESULT_PATH: "unit_results.xml"
GO_VERSION: 1.17.7
jobs:
go-test-race:
name: go-test-race
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Caching dependency
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-v1-go-mod-${{ hashFiles('**/go.mod') }}-${{ hashFiles('**/go.sum') }}
- name: go mod download
run: |
[[ -d ~/go/pkg/mod ]] && exit 0
# retry up to 3 times in case of network issues
for i in $(seq 1 3); do
go mod download && exit 0
sleep 10
done
exit 1
- name: Install gotestsum
run: |
cd /tmp
go install gotest.tools/gotestsum@latest
- name: go test race
run: |
go generate ./...
CGO_ENABLED=1 gotestsum --format short-verbose --junitfile ${{ env.RESULT_PATH }} --raw-command -- go test -race --json ./...
- name: Uploading test results
uses: actions/upload-artifact@v2
with:
name: go-test-race-results
path: ${{ env.RESULT_PATH }}