-
Notifications
You must be signed in to change notification settings - Fork 7
170 lines (141 loc) · 5.41 KB
/
tests.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
name: Tests
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
code-tests:
name: Code
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Differential ShellCheck requires full git history
fetch-depth: 0
- name: Dependency Review
uses: actions/dependency-review-action@v4
if: github.event_name == 'pull_request'
- id: ShellCheck
name: Differential ShellCheck
uses: redhat-plumbers-in-action/differential-shellcheck@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'pull_request'
- name: Upload artifact with ShellCheck defects in SARIF format
uses: actions/upload-artifact@v4
with:
name: Differential ShellCheck SARIF
path: ${{ steps.ShellCheck.outputs.sarif }}
if: github.event_name == 'pull_request'
- name: Install Go
uses: actions/setup-go@v5
- name: Fix repository permissions
run: |
sudo chown -R runner:docker .
- name: Check compatible min Go version
run: |
cd incus-osd
go mod tidy
- name: Download go dependencies
run: |
cd incus-osd
go mod download
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
working-directory: incus-osd
- name: Run test build
run: |
cd incus-osd
go build -v -x ./cmd/incus-osd
end-to-end:
name: End to end testing
strategy:
fail-fast: false
timeout-minutes: 15
runs-on:
- self-hosted
- cpu-4
- mem-4G
- disk-100G
- arch-amd64
- image-debian-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get install --yes \
debian-archive-keyring \
make \
pipx \
qemu-utils
- name: Setup Incus
run: |
curl https://pkgs.zabbly.com/get/incus-daily | sudo sh
sudo chmod 666 /var/lib/incus/unix.socket
incus admin init --auto
- name: Setup mkosi
run: |
pipx install git+https://github.com/systemd/[email protected]
- name: Build initial image
run: |
export PATH=${PATH}:/root/.local/bin
make
- name: Start Incus OS
run: |
qemu-img convert -f raw -O qcow2 $(ls mkosi.output/IncusOS_*.raw | grep -v usr | grep -v esp | sort | tail -1) os-image.qcow2
incus image import --alias incus-os test/metadata.tar.xz os-image.qcow2
incus create --quiet --vm incus-os test-incus-os \
-c security.secureboot=false \
-c limits.cpu=2 \
-c limits.memory=2GiB \
-d root,size=50GiB
incus config device add test-incus-os vtpm tpm
incus start test-incus-os
while :; do
sleep 3
incus exec test-incus-os -- /usr/bin/true >/dev/null 2>&1 && break
done
incus list
- name: Load the extensions
run: |
incus exec test-incus-os -- mkdir -p /var/lib/extensions
incus file push --quiet mkosi.output/debug.raw test-incus-os/var/lib/extensions/
incus file push --quiet mkosi.output/incus.raw test-incus-os/var/lib/extensions/
incus exec test-incus-os -- systemd-sysext list
incus exec test-incus-os -- systemd-sysext merge
- name: Initialize Incus
run: |
incus exec test-incus-os -- systemd-sysusers
incus exec test-incus-os -- systemctl enable --now incus-lxcfs incus-startup incus incus.socket
incus exec test-incus-os -- incus admin init --auto
- name: Test Incus
run: |
incus exec test-incus-os -- incus launch --quiet images:debian/12 c1
incus exec test-incus-os -- incus launch --quiet images:debian/12 v1 --vm
incus exec test-incus-os -- sleep 30s
incus exec test-incus-os -- incus list
- name: Build a newer version of the image
run: |
export PATH=${PATH}:/root/.local/bin
make
- name: Apply the update
run: |
incus file pull --quiet test-incus-os/usr/lib/os-release -
incus file create test-incus-os/var/lib/updates/ --type=directory
incus file push --quiet $(ls mkosi.output/IncusOS_*.efi | sort | tail -1) test-incus-os/var/lib/updates/
incus file push --quiet $(ls mkosi.output/IncusOS_*.usr-x86-64.* | sort | tail -1) test-incus-os/var/lib/updates/
incus file push --quiet $(ls mkosi.output/IncusOS_*.usr-x86-64-verity.* | sort | tail -1) test-incus-os/var/lib/updates/
incus file push --quiet $(ls mkosi.output/IncusOS_*.usr-x86-64-verity-sig.* | sort | tail -1) test-incus-os/var/lib/updates/
incus exec test-incus-os -- systemctl start boot.mount
incus exec test-incus-os -- unshare -m -- sh -c "mount /dev/mapper/usr /usr && /usr/lib/systemd/systemd-sysupdate && /usr/lib/systemd/systemd-sysupdate update && /usr/lib/systemd/systemd-sysupdate && /usr/lib/systemd/systemd-sysupdate reboot"
while :; do
sleep 3
incus exec test-incus-os -- /usr/bin/true >/dev/null 2>&1 && break
done
incus file pull --quiet test-incus-os/usr/lib/os-release -