-
Notifications
You must be signed in to change notification settings - Fork 617
174 lines (165 loc) · 5.44 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
name: test
on:
push:
branches:
- master
- 'release/**'
pull_request:
jobs:
project:
name: Project Checks
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- uses: actions/checkout@v2
with:
path: src/github.com/containerd/nerdctl
fetch-depth: 25
- uses: containerd/project-checks@v1
with:
working-directory: src/github.com/containerd/nerdctl
golangci-lint:
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.35
args: --verbose
test-unit:
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "Run unit tests"
run: go test -v ./pkg/...
test-integration:
runs-on: ubuntu-20.04
timeout-minutes: 20
strategy:
matrix:
containerd: [1.4.5, 1.5.7, 1.6.0-beta.1]
env:
CONTAINERD_VERSION: "${{ matrix.containerd }}"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "Prepare integration test environment"
run: DOCKER_BUILDKIT=1 docker build -t test-integration --target test-integration --build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} .
- name: "Remove snap loopback devices (conflicts with our loopback devices in TestRunDevice)"
run: |
sudo systemctl disable --now snapd.service snapd.socket
sudo apt-get purge -y snapd
sudo losetup -Dv
sudo losetup -lv
- name: "Register QEMU (tonistiigi/binfmt)"
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: "Run integration tests"
run: docker run -t --rm --privileged test-integration go test -v ./cmd/nerdctl/... -args -test.kill-daemon
test-integration-rootless:
runs-on: ubuntu-20.04
timeout-minutes: 20
strategy:
matrix:
containerd: [1.4.5, 1.5.7, 1.6.0-beta.1]
env:
CONTAINERD_VERSION: "${{ matrix.containerd }}"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "Register QEMU (tonistiigi/binfmt)"
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: "Prepare (network driver=slirp4netns, port driver=builtin)"
run: DOCKER_BUILDKIT=1 docker build -t test-integration-rootless --target test-integration-rootless --build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} .
- name: "Test (network driver=slirp4netns, port driver=builtin)"
run: docker run -t --rm --privileged test-integration-rootless
- name: "Prepare (network driver=slirp4netns, port driver=slirp4netns)"
run: DOCKER_BUILDKIT=1 docker build -t test-integration-rootless-port-slirp4netns --target test-integration-rootless-port-slirp4netns --build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} .
- name: "Test (network driver=slirp4netns, port driver=slirp4netns)"
run: docker run -t --rm --privileged test-integration-rootless-port-slirp4netns
cross:
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "Cross"
run: make artifacts
test-integration-docker-compatibility:
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "Register QEMU (tonistiigi/binfmt)"
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: "Ensure that the integration test suite is compatible with Docker"
run: go test -v -exec sudo ./cmd/nerdctl/... -args -test.target=docker -test.kill-daemon
test-integration-cgroup2:
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 40
env:
VAGRANT_VAGRANTFILE: hack/Vagrantfile.fedora
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- uses: actions/checkout@v2
with:
fetch-depth: 1
# Vagrant is slow, so we build binaries outside Vagrant
- name: "Build binaries"
run: |
GOOS=linux make binaries
GOOS=linux go test -c ./cmd/nerdctl
- name: "Boot VM"
run: |
vagrant up
vagrant ssh-config >> ~/.ssh/config
- name: "Show info"
run: ssh default -- sudo nerdctl info
- name: "Run tests"
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
retry_on: error
max_attempts: 2
# TODO: enable -test.kill-daemon
command: ssh default -- "sudo /vagrant/nerdctl.test -test.v"
- name: "Install rootless containerd"
run: |
ssh default -- containerd-rootless-setuptool.sh install
- name: "Show info (rootless)"
run: ssh default -- nerdctl info
- name: "Run tests (rootless)"
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
retry_on: error
max_attempts: 2
command: ssh default -- "/vagrant/nerdctl.test -test.v -test.kill-daemon"
- name: "Uninstall rootless containerd"
run: ssh default -- containerd-rootless-setuptool.sh uninstall