-
Notifications
You must be signed in to change notification settings - Fork 10
69 lines (58 loc) · 1.74 KB
/
test.reusable.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
64
65
66
67
68
69
name: Test
on:
workflow_call:
inputs:
go-version:
required: true
type: string
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
name: Go ${{ inputs.go-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/go/bin
~/.cache
key: ${{ runner.os }}-amd64-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-amd64-go-
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ inputs.go-version }}
- name: Setup go-acc
run: go install github.com/ory/go-acc@latest
- name: Set up gotestfmt
uses: haveyoudebuggedit/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }} # Avoid getting rate limited
- name: Run test
run: |
TEST_BENCH_OPTION="-bench=."
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
set -euo pipefail
go-acc -o cover.out ./... -- \
${TEST_BENCH_OPTION} \
-json \
-v -race 2>&1 | grep -v '^go: downloading' | tee /tmp/gotest.log | gotestfmt
- name: Upload test log
uses: actions/upload-artifact@v3
if: always()
with:
name: test-log-${{ inputs.go-version }}
path: /tmp/gotest.log
if-no-files-found: error
- name: Run TEST_HOOK
run: |
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
if [ -n "${TEST_HOOK}" ]; then ${TEST_HOOK}; fi
- uses: codecov/codecov-action@v3
with:
name: codecov-umbrella
fail_ci_if_error: true
flags: go