-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (52 loc) · 1.53 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
57
58
59
60
61
62
name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Golang-CI (lint)
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4 # action page: <https://github.com/actions/setup-go>
with:
go-version: stable
- name: Run linter
uses: golangci/[email protected]
with:
version: v1.53
args: -v --build-tags=race --timeout=5m
test:
needs: lint
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v4 # action page: <https://github.com/actions/setup-go>
with:
go-version: stable
- name: Check out code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Install Go dependencies
run: go mod download
- name: Run Unit tests
run: go test -race -covermode=atomic -coverprofile /tmp/coverage.txt .
- name: Upload Coverage report to CodeCov
continue-on-error: true
uses: codecov/[email protected] # https://github.com/codecov/codecov-action
with:
file: /tmp/coverage.txt