forked from cri-o/cri-o
-
Notifications
You must be signed in to change notification settings - Fork 0
343 lines (327 loc) · 9.57 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
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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
name: test
on:
push:
tags:
- v*
branches:
- main
- release-*
- nixpkgs
pull_request:
env:
GO_VERSION: '1.21'
NIX_VERSION: '2.19.2'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- run: scripts/github-actions-packages
- run: make
- run: bin/crio version
- run: make bin/crio.cross.linux.amd64
- run: bin/crio.cross.linux.amd64 version
- uses: actions/upload-artifact@v4
with:
name: build
path: |
bin/crio
- uses: actions/upload-artifact@v4
with:
name: docs
path: |
docs/crio.8
docs/crio.conf.5
docs/crio.conf.d.5
- uses: actions/upload-artifact@v4
with:
name: config
path: crio.conf
build-freebsd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- run: scripts/github-actions-packages
- run: make bin/crio.cross.freebsd.amd64
validate-docs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: bin
- run: chmod -R +x bin
- run: |
sudo -E make docs-generation
hack/tree_status.sh
validate-completions:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: bin
- run: chmod -R +x bin
- run: |
sudo -E make completions-generation
hack/tree_status.sh
validate-nri-tests:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: bin
- run: |
sudo -E make check-nri-bats-tests
build-static-amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
with:
install_url: https://releases.nixos.org/nix/nix-${{ env.NIX_VERSION }}/install
- uses: cachix/cachix-action@v13
with:
name: cri-o-static
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
pushFilter: cri-o
- run: nix-build nix
- run: result/bin/crio version
- uses: actions/upload-artifact@v4
with:
name: build-static-amd64
path: |
result/bin/crio
result/bin/pinns
build-static-arm64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
with:
install_url: https://releases.nixos.org/nix/nix-${{ env.NIX_VERSION }}/install
- uses: cachix/cachix-action@v13
with:
name: cri-o-static
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
pushFilter: cri-o
- run: nix-build nix/default-arm64.nix
- run: file result/bin/crio | grep aarch64
- uses: actions/upload-artifact@v4
with:
name: build-static-arm64
path: |
result/bin/crio
result/bin/pinns
build-static-ppc64le:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
with:
install_url: https://releases.nixos.org/nix/nix-${{ env.NIX_VERSION }}/install
- uses: cachix/cachix-action@v13
with:
name: cri-o-static
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
pushFilter: cri-o
- run: nix-build nix/default-ppc64le.nix
- run: file result/bin/crio | grep PowerPC
- uses: actions/upload-artifact@v4
with:
name: build-static-ppc64le
path: |
result/bin/crio
result/bin/pinns
static-build-upload:
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs:
- build-static-amd64
- build-static-arm64
- build-static-ppc64le
steps:
- uses: actions/download-artifact@v4
with:
name: build-static-amd64
path: ${{ github.sha }}/amd64
- uses: actions/download-artifact@v4
with:
name: build-static-arm64
path: ${{ github.sha }}/arm64
- uses: actions/download-artifact@v4
with:
name: build-static-ppc64le
path: ${{ github.sha }}/ppc64le
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCS_CRIO_SA }}
- uses: google-github-actions/upload-cloud-storage@v2
with:
path: ${{ github.sha }}
destination: cri-o/artifacts
upload-artifacts:
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs:
- static-build-upload
steps:
- uses: actions/checkout@v4
- run: make upload-artifacts
env:
GCS_CRIO_SA: ${{ secrets.GCS_CRIO_SA }}
create-release:
if: contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs:
- release-notes
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: release-notes
path: build/release-notes
- name: Get release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
bodyFile: build/release-notes/${{ env.RELEASE_VERSION }}.md
token: ${{ secrets.GH_TOKEN }}
unit:
strategy:
matrix:
run:
- runner: ubuntu-latest
arch: amd64
- runner: actuated-arm64-4cpu-16gb
arch: arm64
name: unit / ${{ matrix.run.arch }}
runs-on: ${{ matrix.run.runner }}
steps:
- uses: alexellis/arkade-get@master
with:
crane: latest
print-summary: false
- name: Install vmmeter
run: crane export --platform linux/${{ matrix.run.arch }} ghcr.io/openfaasltd/vmmeter:latest | sudo tar -xvf - -C /usr/local/bin
- uses: self-actuated/vmmeter-action@master
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-unit-${{ matrix.run.arch }}-${{ hashFiles('**/go.sum') }}
- run: scripts/github-actions-packages
- name: Update mocks
run: |
make mockgen -j $(nproc)
hack/tree_status.sh
- name: Run unit tests
run: |
sudo PATH="$PATH" GOCACHE="$(go env GOCACHE)" GOMODCACHE="$(go env GOMODCACHE)" make testunit
sudo chown -R $(id -u):$(id -g) "$(go env GOCACHE)" "$(go env GOMODCACHE)"
- uses: actions/upload-artifact@v4
with:
name: unit-${{ matrix.run.arch }}
path: build/coverage
coverage:
needs: unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: unit-amd64
path: build/coverage
- run: make codecov
release-notes:
permissions:
contents: none
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Set current branch
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "CURRENT_BRANCH=$branch" >> $GITHUB_ENV
- run: make release-notes
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: release-notes
path: build/release-notes
if-no-files-found: ignore
dependencies:
permissions:
contents: none
if: github.ref == 'refs/heads/main'
needs: release-notes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- run: make dependencies
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: dependencies
path: build/dependencies
codeql-build:
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with:
languages: go
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
security-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run Govulncheck
run: make verify-govulncheck
- name: Run Gosec
run: make verify-gosec