-
Notifications
You must be signed in to change notification settings - Fork 109
56 lines (48 loc) · 1.24 KB
/
tests.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
on:
push:
branches:
- master
- main
pull_request:
# Only run if there are changes to Go code or related configurations
paths:
- "**.go"
- "go.mod"
- "go.sum"
- "codecov.yml"
name: Tests
jobs:
test-cache:
name: "Run unit tests"
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.18.x, 1.x]
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Test with race and coverage
run: |
go test -race -coverprofile=coverage.out -covermode=atomic
go tool cover -func=coverage.out
- uses: codecov/codecov-action@v4
with:
files: ./coverage.out
token: ${{ secrets.CODECOV_TOKEN }} # required
lint:
name: "Run static analysis"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: "1.x"
- run: "go vet ./..."
- name: Staticcheck
uses: dominikh/[email protected]
with:
install-go: false