-
Notifications
You must be signed in to change notification settings - Fork 372
283 lines (272 loc) · 8.91 KB
/
go.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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: Go
on:
pull_request:
branches:
- main
- release-*
- feature/*
push:
branches:
- main
- release-*
- feature/*
jobs:
check-changes:
name: Check whether tests need to be run based on diff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: false
- uses: antrea-io/has-changes@v2
id: check_diff
with:
paths-ignore: docs/* ci/jenkins/* *.md hack/.notableofcontents
outputs:
has_changes: ${{ steps.check_diff.outputs.has_changes }}
# test-unit-ubuntu and test-unit-windows are intentionally not merged into one job with os matrix, otherwise the job
# wouldn't be expanded if it's skipped and the report of the required check would be missing.
# See https://github.com/antrea-io/antrea/issues/3563.
test-unit-ubuntu:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Unit test (ubuntu-latest)
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run unit tests
run: make test-unit
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: .coverage/coverage-unit.txt
disable_search: true
flags: unit-tests
name: codecov-unit-test
fail_ci_if_error: ${{ github.event_name == 'push' }}
test-unit-windows:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Unit test (windows-2022)
runs-on: [windows-2022]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run unit tests
run: make test-unit
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: .coverage/coverage-unit.txt
disable_search: true
flags: unit-tests
name: codecov-unit-test
fail_ci_if_error: ${{ github.event_name == 'push' }}
test-integration:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Integration test
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run integration tests
run: |
./build/images/ovs/build.sh
NO_PULL=1 make docker-test-integration
- name: Run integration tests for multicluster
run: |
cd multicluster
make test-integration
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: .coverage/coverage-integration.txt,multicluster/.coverage/coverage-integration.txt
disable_search: true
flags: integration-tests
name: codecov-integration-test
fail_ci_if_error: ${{ github.event_name == 'push' }}
# golangci-lint-ubuntu and golangci-lint-macos are intentionally not merged into one job with os matrix, otherwise the
# job wouldn't be expanded if it's skipped and the report of the required check would be missing.
# See https://github.com/antrea-io/antrea/issues/3563.
golangci-lint-ubuntu:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Golangci-lint (ubuntu-latest)
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run golangci-lint
run: make golangci
golangci-lint-macos:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Golangci-lint (macos-latest)
runs-on: [macos-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run golangci-lint
run: make golangci
bin:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Build Antrea and antctl binaries
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build Antrea binaries for amd64
run: GOARCH=amd64 make bin
- name: Build Antrea binaries for arm64
run: GOARCH=arm64 make bin
- name: Build Antrea binaries for arm
run: GOARCH=arm make bin
- name: Build antctl binary for linux amd64
run: GOOS=linux GOARCH=amd64 make antctl
- name: Build antctl binary for linux arm64
run: GOOS=linux GOARCH=arm64 make antctl
- name: Build antctl binary for linux arm
run: GOOS=linux GOARCH=arm make antctl
- name: Build antctl binary for windows amd64
run: GOOS=windows GOARCH=amd64 make antctl
- name: Build antctl binary for darwin amd64
run: GOOS=darwin GOARCH=amd64 make antctl
- name: Build antctl binary for darwin arm64
run: GOOS=darwin GOARCH=arm64 make antctl
- name: Build Multi-cluster binaries
run: |
cd multicluster
make bin
windows-bin:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Build Antrea Windows binaries
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build Antrea windows binaries
run: make windows-bin
tidy-codegen-manifest:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Check tidy, code generation and manifest
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
# tidy check need to be run before code generation which will regenerate codes.
- name: Check tidy
run: make test-tidy
- name: Check code generation
run: ./ci/check-codegen.sh
- name: Check manifest
run: ./ci/check-manifest.sh
- name: Check copyright
run: ./ci/check-copyright.sh
verify:
name: Verify docs and spelling
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run verify scripts
run: make verify
- name: Checking for broken Markdown links
if: ${{ github.event_name == 'pull_request' }}
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
# Check modified files only for pull requests. Cronjob "Verify docs" takes care of checking all markdown files.
check-modified-files-only: yes
base-branch: ${{ github.base_ref }}
config-file: 'hack/.md_links_config.json'
- name: Markdownlint
run: |
sudo npm install -g [email protected]
make markdownlint
- name: Checking whether autogenerated Helm chart documentation is up-to-date
working-directory: build/charts/
run: |
make helm-docs
DIFF=$(git diff .)
if [ -n "$DIFF" ]; then
echo "The Helm chart documentation is out-of-date; please run 'make helm-docs' in 'build/charts/' and commit the changes"
exit 1
fi
benchmark:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Go benchmark test
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run Go benchmark test
run: go test -run '^$' -bench . -benchtime 1x -timeout 10m -cpu 4 -v -benchmem ./pkg/...