-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (50 loc) · 1.64 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
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Test, Lint
on:
push:
pull_request_target:
env:
GO_VERSION: "1.21"
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name }}
steps:
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Go modules
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-${{ env.GO_VERSION }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ env.GO_VERSION }}-go-
- name: Run tests
run: go test -race -covermode=atomic ./...
lint:
name: Run linter
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name }}
steps:
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Go modules
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-${{ env.GO_VERSION }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ env.GO_VERSION }}-go-
- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-cache: true