forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 7
158 lines (147 loc) · 5.7 KB
/
Copy pathlint-go.yaml
File metadata and controls
158 lines (147 loc) · 5.7 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Go Related Checks
# Any change in triggers needs to be reflected in the concurrency group.
on:
pull_request: {}
push:
branches:
- main
- ft/main/**
# Add this workflow to be triggered by merge queue events
merge_group:
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}
cancel-in-progress: ${{ !github.event.merge_group }}
jobs:
go-mod:
name: Check Go Modules
runs-on: ubuntu-24.04
steps:
- name: Install Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
# renovate: datasource=golang-version depName=go
go-version: 1.25.3
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Check module vendoring
run: |
go mod tidy
go mod vendor
test -z "$(git status --porcelain)" || (echo "please run 'go mod tidy && go mod vendor', and submit your changes"; exit 1)
license-check:
name: Check third party dependencies licenses
runs-on: ubuntu-24.04
steps:
- name: Install Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
# renovate: datasource=golang-version depName=go
go-version: 1.25.3
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Check for unauthorized dependencies
run: go run ./tools/licensecheck ./... 2>/dev/null
golangci:
name: Lint Source Code
runs-on: ${{ vars.GH_RUNNER_EXTRA_POWER_UBUNTU_LATEST || 'ubuntu-24.04' }}
steps:
- name: Collect Workflow Telemetry
uses: catchpoint/workflow-telemetry-action@94c3c3d9567a0205de6da68a76c428ce4e769af1 # v2.0.0
with:
comment_on_pr: false
- name: Install Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
# renovate: datasource=golang-version depName=go
go-version: 1.25.3
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Run golangci-lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
# renovate: datasource=docker depName=golangci/golangci-lint
version: v2.5.0
skip-cache: true
args: "--verbose --modules-download-mode=vendor"
precheck:
runs-on: ubuntu-24.04
name: Precheck
steps:
- name: Install Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
# renovate: datasource=golang-version depName=go
go-version: 1.25.3
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
# hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
path: src/github.com/cilium/cilium
- name: Executables check
run: |
cd src/github.com/cilium/cilium
HELP="check permissions of files and allowlist them in contrib/executable_list.txt if you are adding a new executable"
make check-permissions || (echo $HELP; exit 1)
- name: Go code prechecks
run: |
cd src/github.com/cilium/cilium
make precheck
- name: Custom linters
run: |
cd src/github.com/cilium/cilium
make custom-lint
generate-api:
runs-on: ubuntu-24.04
name: Generate API
steps:
- name: Install Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
# renovate: datasource=golang-version depName=go
go-version: 1.25.3
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
# hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
path: src/github.com/cilium/cilium
- name: Check api generated files
env:
BUILDER_GOCACHE_DIR: "/tmp/.cache/go/.cache/go-build"
BUILDER_GOMODCACHE_DIR: "/tmp/.cache/go/pkg"
run: |
cd src/github.com/cilium/cilium
contrib/scripts/check-api-code-gen.sh
generate-k8s-api:
runs-on: ubuntu-24.04
name: Generate k8s API
steps:
- name: Install Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
# renovate: datasource=golang-version depName=go
go-version: 1.25.3
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
# hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
path: src/github.com/cilium/cilium
- name: Check k8s generated files
env:
BUILDER_GOCACHE_DIR: "/tmp/.cache/go/.cache/go-build"
BUILDER_GOMODCACHE_DIR: "/tmp/.cache/go/pkg"
run: |
# Set GOBIN to ensure 'go install' binaries end up in the same directory
# as the one actions/setup-go adds to PATH, regardless of GOPATH.
export GOBIN="$HOME/go/bin"
cd src/github.com/cilium/cilium
contrib/scripts/check-k8s-code-gen.sh