51 lines (51 loc) · 1.73 KB
/
test.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
name: Tests
on:
push:
branches: main
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: Setup Go
uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f # tag=v3
with:
go-version: '1.x'
cache: true
- name: Get Go Modules Cache location
run: echo "::set-output name=dir::$(go env GOMODCACHE)"
id: go-modules-cache
- name: Get Go Build Cache Location
run: echo "::set-output name=dir::$(go env GOCACHE)"
id: go-build-cache
- name: Setup Go Modules Cache
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
with:
restore-keys: go-modules-
path: ${{steps.go-modules-cache.outputs.dir}}
key: go-modules-${{hashFiles('**/go.sum')}}
- name: Setup Go Build Cache
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
with:
restore-keys: go-build-
path: ${{steps.go-build-cache.outputs.dir}}
key: go-modules-${{hashFiles('**/go.mod', '**/go.sum')}}
- name: Setup gotestfmt
uses: haveyoudebuggedit/gotestfmt-action@v2
with:
token: ${{github.token}}
- name: Run Tests
run: >-
go test -v ./...
-json
-coverprofile coverage.out
-cover ${{github.workspace}}
2>&1 | gotestfmt
- name: Upload Code Coverage
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # tag=v3.1.1
with:
fail_ci_if_error: true
directory: ${{github.workspace}}
files: coverage.out