11
11
12
12
env :
13
13
GO_VERSION : 1.23.x
14
+ SHORT_TIMEOUT : 5
15
+ LONG_TIMEOUT : 60
14
16
15
17
jobs :
16
- lint :
17
- runs-on : ubuntu-24.04
18
- timeout-minutes : 20
18
+ lint-go :
19
+ # Supposed to work: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#example-returning-a-json-data-type
20
+ # Apparently does not
21
+ # timeout-minutes: ${{ fromJSON(env.SHORT_TIMEOUT) }}
22
+ timeout-minutes : 5
23
+ name : lint-go ${{ matrix.goos }}
24
+ runs-on : " ${{ matrix.os }}"
25
+ strategy :
26
+ matrix :
27
+ include :
28
+ - os : ubuntu-24.04
29
+ goos : linux
30
+ - os : ubuntu-24.04
31
+ goos : freebsd
32
+ # FIXME: this is currently failing in a non-sensical way, so, running on linux instead...
33
+ # - os: windows-2022
34
+ - os : ubuntu-24.04
35
+ goos : windows
36
+ env :
37
+ GOOS : " ${{ matrix.goos }}"
19
38
steps :
20
- - uses : actions/checkout@v4.2.1
39
+ - uses : actions/checkout@v4
21
40
with :
22
41
fetch-depth : 1
23
42
- uses : actions/setup-go@v5
@@ -26,24 +45,45 @@ jobs:
26
45
check-latest : true
27
46
cache : true
28
47
- name : golangci-lint
29
- uses : golangci/golangci-lint-action@v6.1.1
48
+ uses : golangci/golangci-lint-action@v6
30
49
with :
31
- version : v1.60.1
32
50
args : --verbose
33
- - name : yamllint-lint
51
+
52
+ lint-other :
53
+ timeout-minutes : 5
54
+ runs-on : ubuntu-24.04
55
+ steps :
56
+ - uses : actions/checkout@v4
57
+ with :
58
+ fetch-depth : 1
59
+ - uses : actions/setup-go@v5
60
+ with :
61
+ go-version : ${{ env.GO_VERSION }}
62
+ check-latest : true
63
+ cache : true
64
+ - name : yaml
34
65
run : make lint-yaml
35
- - name : shellcheck
66
+ - name : shell
36
67
run : make lint-shell
37
68
- name : go imports ordering
38
69
run : |
39
70
go install -v github.com/incu6us/goimports-reviser/v3@latest
40
71
make lint-imports
41
72
42
73
test-unit :
43
- runs-on : ubuntu-24.04
44
- timeout-minutes : 20
74
+ timeout-minutes : 5
75
+ name : unit ${{ matrix.goos }}
76
+ runs-on : " ${{ matrix.os }}"
77
+ strategy :
78
+ matrix :
79
+ include :
80
+ # FIXME: currently disabled as a lot more work is required to make these tests pass on windows
81
+ # - os: windows-2022
82
+ # goos: windows
83
+ - os : ubuntu-24.04
84
+ goos : linux
45
85
steps :
46
- - uses : actions/checkout@v4.2.1
86
+ - uses : actions/checkout@v4
47
87
with :
48
88
fetch-depth : 1
49
89
- uses : actions/setup-go@v5
@@ -52,11 +92,12 @@ jobs:
52
92
check-latest : true
53
93
cache : true
54
94
- name : " Run unit tests"
55
- run : go test -v ./pkg/...
95
+ run : make test-unit
56
96
57
97
test-integration :
98
+ timeout-minutes : 60
99
+ name : integration ${{ matrix.containerd }} ${{ matrix.runner }}
58
100
runs-on : " ${{ matrix.runner }}"
59
- timeout-minutes : 40
60
101
strategy :
61
102
fail-fast : false
62
103
matrix :
78
119
UBUNTU_VERSION : " ${{ matrix.ubuntu }}"
79
120
CONTAINERD_VERSION : " ${{ matrix.containerd }}"
80
121
steps :
81
- - uses : actions/checkout@v4.2.1
122
+ - uses : actions/checkout@v4
82
123
with :
83
124
fetch-depth : 1
84
125
- name : " Prepare integration test environment"
@@ -99,16 +140,16 @@ jobs:
99
140
docker run --privileged --rm tonistiigi/binfmt --install linux/arm64
100
141
docker run --privileged --rm tonistiigi/binfmt --install linux/arm/v7
101
142
- name : " Run integration tests"
102
- uses : nick-fields/retry@v3
103
- with :
104
- timeout_minutes : 30
105
- max_attempts : 2
106
- retry_on : error
107
- command : docker run -t --rm --privileged test-integration
143
+ run : |
144
+ docker run -t --rm --privileged test-integration ./hack/test-integration.sh
145
+ - name : " Run integration tests (flaky)"
146
+ run : |
147
+ docker run -t --rm --privileged test-integration ./hack/test-integration.sh -test.only-flaky
108
148
109
149
test-integration-ipv6 :
150
+ timeout-minutes : 60
151
+ name : ipv6 ${{ matrix.containerd }} ${{ matrix.ubuntu }}
110
152
runs-on : " ubuntu-${{ matrix.ubuntu }}"
111
- timeout-minutes : 40
112
153
strategy :
113
154
fail-fast : false
114
155
matrix :
@@ -120,7 +161,7 @@ jobs:
120
161
UBUNTU_VERSION : " ${{ matrix.ubuntu }}"
121
162
CONTAINERD_VERSION : " ${{ matrix.containerd }}"
122
163
steps :
123
- - uses : actions/checkout@v4.2.1
164
+ - uses : actions/checkout@v4
124
165
with :
125
166
fetch-depth : 1
126
167
- name : Enable ipv4 and ipv6 forwarding
@@ -133,7 +174,7 @@ jobs:
133
174
echo '{"ipv6": true, "fixed-cidr-v6": "2001:db8:1::/64", "experimental": true, "ip6tables": true}' | sudo tee /etc/docker/daemon.json
134
175
sudo systemctl restart docker
135
176
- name : " Prepare integration test environment"
136
- run : docker build -t test-integration-ipv6 --target test-integration-ipv6 --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} .
177
+ run : docker build -t test-integration --target test-integration --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} .
137
178
- name : " Remove snap loopback devices (conflicts with our loopback devices in TestRunDevice)"
138
179
run : |
139
180
sudo systemctl disable --now snapd.service snapd.socket
@@ -151,20 +192,16 @@ jobs:
151
192
docker run --privileged --rm tonistiigi/binfmt --install linux/arm/v7
152
193
- name : " Run integration tests"
153
194
# The nested IPv6 network inside docker and qemu is complex and needs a bunch of sysctl config.
154
- # Therefore it's hard to debug why the IPv6 tests fail in such an isolation layer.
195
+ # Therefore, it's hard to debug why the IPv6 tests fail in such an isolation layer.
155
196
# On the other side, using the host network is easier at configuration.
156
197
# Besides, each job is running on a different instance, which means using host network here
157
198
# is safe and has no side effects on others.
158
- uses : nick-fields/retry@v3
159
- with :
160
- timeout_minutes : 30
161
- max_attempts : 2
162
- retry_on : error
163
- command : docker run --network host -t --rm --privileged test-integration-ipv6
199
+ run : docker run --network host -t --rm --privileged test-integration ./hack/test-integration.sh -test.only-ipv6
164
200
165
201
test-integration-rootless :
166
- runs-on : " ubuntu-${{ matrix.ubuntu }}"
167
202
timeout-minutes : 60
203
+ name : rootless ${{ matrix.containerd }} ${{ matrix.rootlesskit }} ${{ matrix.ubuntu }} ${{ matrix.target }}
204
+ runs-on : " ubuntu-${{ matrix.ubuntu }}"
168
205
strategy :
169
206
fail-fast : false
170
207
matrix :
@@ -207,7 +244,7 @@ jobs:
207
244
}
208
245
EOT
209
246
sudo systemctl restart apparmor.service
210
- - uses : actions/checkout@v4.2.1
247
+ - uses : actions/checkout@v4
211
248
with :
212
249
fetch-depth : 1
213
250
- name : " Register QEMU (tonistiigi/binfmt)"
@@ -230,21 +267,18 @@ jobs:
230
267
fi
231
268
echo "WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622}" >> "$GITHUB_ENV"
232
269
- name : " Test (network driver=slirp4netns, port driver=builtin)"
233
- uses : nick-fields/retry@v3
234
- with :
235
- timeout_minutes : 30
236
- max_attempts : 2
237
- retry_on : error
238
- command : docker run -t --rm --privileged -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622} ${TEST_TARGET}
270
+ run : docker run -t --rm --privileged -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622} ${TEST_TARGET} /test-integration-rootless.sh ./hack/test-integration.sh
271
+ - name : " Test (network driver=slirp4netns, port driver=builtin) (flaky)"
272
+ run : docker run -t --rm --privileged -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622} ${TEST_TARGET} /test-integration-rootless.sh ./hack/test-integration.sh -test.only-flaky
239
273
240
274
cross :
275
+ timeout-minutes : 5
241
276
runs-on : ubuntu-24.04
242
- timeout-minutes : 40
243
277
strategy :
244
278
matrix :
245
279
go-version : ["1.22.x", "1.23.x"]
246
280
steps :
247
- - uses : actions/checkout@v4.2.1
281
+ - uses : actions/checkout@v4
248
282
with :
249
283
fetch-depth : 1
250
284
- uses : actions/setup-go@v5
@@ -256,10 +290,10 @@ jobs:
256
290
run : GO_VERSION="$(echo ${{ matrix.go-version }} | sed -e s/.x//)" make binaries
257
291
258
292
test-integration-docker-compatibility :
293
+ timeout-minutes : 60
259
294
runs-on : ubuntu-24.04
260
- timeout-minutes : 45
261
295
steps :
262
- - uses : actions/checkout@v4.2.1
296
+ - uses : actions/checkout@v4
263
297
with :
264
298
fetch-depth : 1
265
299
- uses : actions/setup-go@v5
@@ -284,31 +318,22 @@ jobs:
284
318
- name : " Prepare integration test environment"
285
319
run : |
286
320
sudo apt-get install -y expect
321
+ go install -v gotest.tools/gotestsum@v1
287
322
- name : " Ensure that the integration test suite is compatible with Docker"
288
- uses : nick-fields/retry@v3
289
- with :
290
- timeout_minutes : 30
291
- max_attempts : 2
292
- retry_on : error
293
- # See https://github.com/containerd/nerdctl/blob/main/docs/testing/README.md#about-parallelization
294
- command : go test -p 1 -timeout 20m -v -exec sudo ./cmd/nerdctl/... -args -test.target=docker -test.allow-kill-daemon
323
+ run : ./hack/test-integration.sh -test.target=docker
295
324
- name : " Ensure that the IPv6 integration test suite is compatible with Docker"
296
- uses : nick-fields/retry@v3
297
- with :
298
- timeout_minutes : 30
299
- max_attempts : 2
300
- retry_on : error
301
- # See https://github.com/containerd/nerdctl/blob/main/docs/testing/README.md#about-parallelization
302
- command : go test -p 1 -timeout 20m -v -exec sudo ./cmd/nerdctl/... -args -test.target=docker -test.allow-kill-daemon -test.only-ipv6
325
+ run : ./hack/test-integration.sh -test.target=docker -test.only-ipv6
326
+ - name : " Ensure that the integration test suite is compatible with Docker (flaky only)"
327
+ run : ./hack/test-integration.sh -test.target=docker -test.only-flaky
303
328
304
329
test-integration-windows :
330
+ timeout-minutes : 60
305
331
runs-on : windows-2022
306
- timeout-minutes : 30
307
332
defaults :
308
333
run :
309
334
shell : bash
310
335
steps :
311
- - uses : actions/checkout@v4.2.1
336
+ - uses : actions/checkout@v4
312
337
with :
313
338
fetch-depth : 1
314
339
- uses : actions/setup-go@v5
@@ -317,7 +342,8 @@ jobs:
317
342
cache : true
318
343
check-latest : true
319
344
- run : go install ./cmd/nerdctl
320
-
345
+ - run : go install -v gotest.tools/gotestsum@v1
346
+ - uses : actions/checkout@v4
321
347
with :
322
348
repository : containerd/containerd
323
349
ref : v1.7.22
@@ -330,19 +356,21 @@ jobs:
330
356
env :
331
357
ctrdVersion : 1.7.22
332
358
run : powershell hack/configure-windows-ci.ps1
333
- # TODO: Run unit tests
334
359
- name : " Run integration tests"
335
- # See https://github.com/containerd/nerdctl/blob/main/docs/testing/README.md#about-parallelization
336
- run : go test -p 1 -v ./cmd/nerdctl/...
360
+ run : |
361
+ ./hack/test-integration.sh
362
+ - name : " Run integration tests (flaky)"
363
+ run : |
364
+ ./hack/test-integration.sh -test.only-flaky
337
365
338
366
test-integration-freebsd :
367
+ timeout-minutes : 60
339
368
name : FreeBSD
340
369
# ubuntu-24.04 lacks the vagrant package
341
370
runs-on : ubuntu-22.04
342
- timeout-minutes : 20
343
371
344
372
steps :
345
- - uses : actions/checkout@v4.2.1
373
+ - uses : actions/checkout@v4
346
374
- uses : actions/cache@v4
347
375
with :
348
376
path : /root/.vagrant.d
0 commit comments