Skip to content

Commit 855da42

Browse files
committed
CI: move FreeBSD tests to GHA
Signed-off-by: Akihiro Suda <[email protected]>
1 parent 65934e9 commit 855da42

File tree

4 files changed

+93
-20
lines changed

4 files changed

+93
-20
lines changed

.cirrus.yml

-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
freebsd_task:
2-
name: FreeBSD
3-
timeout_in: 20m
4-
compute_engine_instance:
5-
image_project: freebsd-org-cloud-dev
6-
image: family/freebsd-13-0
7-
platform: freebsd
8-
cpu: 2
9-
memory: 4G
10-
env:
11-
NERDCTL_RUN_ARGS: --net none dougrabson/freebsd-minimal:13 echo "Nerdctl is up and running."
12-
install_script:
13-
- pkg install -y go containerd runj
14-
test_script:
15-
- daemon -o containerd.out containerd
16-
- go test -v ./pkg/...
17-
- cd cmd/nerdctl
18-
- sudo go run . run $NERDCTL_RUN_ARGS | grep running
19-
# TODO: run `go test -v ./cmd/...`
20-
211
windows_task:
222
name: "Windows"
233
timeout_in: 20m

.github/workflows/test.yml

+28
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,31 @@ jobs:
211211
sudo apt-get install -y expect
212212
- name: "Ensure that the integration test suite is compatible with Docker"
213213
run: go test -timeout 20m -v -exec sudo ./cmd/nerdctl/... -args -test.target=docker -test.kill-daemon
214+
215+
216+
test-integration-freebsd:
217+
name: FreeBSD
218+
# "Larger" runner is needed for nested virtualization
219+
# https://github.com/organizations/containerd/settings/actions/runners
220+
runs-on: ubuntu-latest-4-cores
221+
timeout-minutes: 20
222+
223+
steps:
224+
- uses: actions/[email protected]
225+
- uses: actions/cache@v3
226+
with:
227+
path: /root/.vagrant.d
228+
key: vagrant-${{ matrix.box }}
229+
- name: Set up vagrant
230+
run: |
231+
sudo apt-get update
232+
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant vagrant-libvirt
233+
sudo systemctl enable --now libvirtd
234+
- name: Boot VM
235+
run: |
236+
ln -sf Vagrantfile.freebsd Vagrantfile
237+
sudo vagrant up --no-tty
238+
- name: test-unit
239+
run: sudo vagrant up --provision-with=test-unit
240+
- name: test-integration
241+
run: sudo vagrant up --provision-with=test-integration

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ _output
77

88
# vagrant
99
/.vagrant
10+
Vagrantfile

Vagrantfile.freebsd

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Copyright The containerd Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
# Vagrantfile for FreeBSD
19+
Vagrant.configure("2") do |config|
20+
config.vm.box = "generic/freebsd13"
21+
22+
memory = 2048
23+
cpus = 1
24+
config.vm.provider :virtualbox do |v, o|
25+
v.memory = memory
26+
v.cpus = cpus
27+
end
28+
config.vm.provider :libvirt do |v|
29+
v.memory = memory
30+
v.cpus = cpus
31+
end
32+
33+
config.vm.synced_folder ".", "/vagrant", type: "rsync"
34+
35+
config.vm.provision "install", type: "shell", run: "once" do |sh|
36+
sh.inline = <<~SHELL
37+
#!/usr/bin/env bash
38+
set -eux -o pipefail
39+
pkg install -y go containerd runj
40+
cd /vagrant
41+
go install ./cmd/nerdctl
42+
SHELL
43+
end
44+
45+
config.vm.provision "test-unit", type: "shell", run: "never" do |sh|
46+
sh.inline = <<~SHELL
47+
#!/usr/bin/env bash
48+
set -eux -o pipefail
49+
cd /vagrant
50+
go test -v ./pkg/...
51+
SHELL
52+
end
53+
54+
config.vm.provision "test-integration", type: "shell", run: "never" do |sh|
55+
sh.inline = <<~SHELL
56+
#!/usr/bin/env bash
57+
set -eux -o pipefail
58+
daemon -o containerd.out containerd
59+
sleep 3
60+
/root/go/bin/nerdctl run --rm --net=none dougrabson/freebsd-minimal:13 echo "Nerdctl is up and running."
61+
SHELL
62+
end
63+
64+
end

0 commit comments

Comments
 (0)