-
Notifications
You must be signed in to change notification settings - Fork 4
76 lines (63 loc) · 1.84 KB
/
Copy pathlint.yml
File metadata and controls
76 lines (63 loc) · 1.84 KB
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
70
71
72
73
74
75
76
name: Lint & Test
on:
push:
branches: [ master, v2 ]
pull_request:
branches: [ master, v2 ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Create cache directories
run: |
mkdir -p ~/.cache/golangci-lint
mkdir -p ~/.cache/go-build
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Go Lint Cache
uses: actions/cache@v4
with:
path: ~/.cache/golangci-lint/
key: go-lint-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
go-lint-cache-${{ runner.os }}-
- name: Go Mod Cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
key: go-mod-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
go-mod-cache-${{ runner.os }}-
- name: Check go mod
run: |
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
args: --timeout=10m --verbose
skip-cache: false
env:
GOLANGCI_LINT_CACHE: go-lint-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Go Mod Cache
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: go-test-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
go-test-cache-${{ runner.os }}-
- name: Run tests
run: go test ./... -race -count=1 -timeout=15m
- name: Run vet
run: go vet ./...