-
Notifications
You must be signed in to change notification settings - Fork 10
74 lines (68 loc) · 1.86 KB
/
ci.yaml
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
name: CI
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
permissions:
contents: read
jobs:
fmt:
name: Format
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: false
- name: Check Go modules
run: |
go mod tidy && git add go.* &&
git diff --cached --exit-code || (echo 'Please run "go mod tidy" to sync Go modules' && exit 1);
- name: Verify gofumpt
run: |
echo "refer to https://github.com/mvdan/gofumpt for detailed info" &&
GO111MODULE=on go install mvdan.cc/[email protected] &&
make fmt && git add pkg cmd &&
git diff --cached --exit-code || (echo 'Please run "make fmt" to verify fmt' && exit 1);
vet:
name: Vet
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: false
- name: Verify govet
run: |
make vet && git add pkg cmd &&
git diff --cached --exit-code || (echo 'Please run "make vet" to verify govet' && exit 1);
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=10m
license:
name: License
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Check license header
run: |
make license && git add pkg cmd &&
git diff --cached --exit-code || (echo 'Please run "make license" to add license headers' && exit 1);