-
Notifications
You must be signed in to change notification settings - Fork 8
293 lines (226 loc) · 7.2 KB
/
build.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
name: build
on:
push:
branches: [ main, next, staging ]
pull_request:
branches: [ main, next ]
jobs:
sanity:
name: "basic sanity build"
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: checkout libnvme
uses: actions/checkout@v4
with:
repository: linux-nvme/libnvme
path: libnvme
ref: v1.4
- name: install build dependencies
run: sudo pip install meson ninja sphinx sphinx-rtd-theme
- name: compile and install libnvme
run: |
cd libnvme
make
sudo make install
- name: configure build
run: meson setup build
- name: compile
run: meson compile -C build
- name: unit tests
run: |
meson test -C build libvfn:
- name: configure release build
run: meson setup --reconfigure build --buildtype=release
- name: compile
run: meson compile -C build
- name: unit tests
run: |
meson test -C build libvfn:
sparse:
name: "run sparse"
needs: [sanity]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: install build dependencies
run: sudo pip install meson ninja
- name: install sparse
run: sudo apt-get -y install sparse
- name: configure build
run: meson setup build
- name: run sparse
run: meson compile -C build sparse
scan-build:
name: "run scan-build"
needs: [sanity]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: install build dependencies
run: sudo pip install meson ninja
- name: install scan-build
run: sudo apt-get -y install clang-tools
- name: configure build
run: meson setup build
- name: run scan-build
run: scan-build -o /tmp/scan-build-report --status-bugs ninja -C build
- name: grab bug report
uses: actions/upload-artifact@v3
if: failure()
with:
name: scan-build-report
path: /tmp/scan-build-report/*
cc-builds:
name: "compiler builds"
needs: [sanity]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
steps:
- name: checkout
uses: actions/checkout@v4
- name: install build dependencies
run: sudo pip install meson ninja
- name: configure build
run: CC=${{ matrix.compiler }} meson setup build -Dlibnvme=disabled
- name: compile
run: meson compile -C build
dist-builds:
name: "distribution builds"
needs: [sanity]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container:
- {os: 'almalinux', ver: '8'}
- {os: 'almalinux', ver: '9'}
- {os: 'alpine', ver: 'latest'}
- {os: 'archlinux', ver: 'latest'}
- {os: 'debian', ver: 'trixie'}
- {os: 'debian', ver: 'bookworm'}
- {os: 'debian', ver: 'bullseye'}
- {os: 'debian', ver: 'buster'}
- {os: 'fedora', ver: 'rawhide'}
- {os: 'fedora', ver: '38'}
- {os: 'fedora', ver: '37'}
- {os: 'rockylinux', ver: '8'}
- {os: 'rockylinux', ver: '9'}
- {os: 'ubuntu', ver: 'mantic'}
- {os: 'ubuntu', ver: 'lunar'}
- {os: 'ubuntu', ver: 'jammy'}
- {os: 'ubuntu', ver: 'focal'}
container:
image: ${{ matrix.container.os }}:${{ matrix.container.ver }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: install dependencies
env:
SETUP_SCRIPT: .github/scripts/build/${{ matrix.container.os}}-setup-${{ matrix.container.ver }}.sh
run: ${SETUP_SCRIPT}
- name: configure build
run: meson setup build -Dlibnvme=disabled
- name: compile
run: ninja -C build
- name: upload log
uses: actions/upload-artifact@v3
if: failure()
with:
name: meson log
path: build/meson-logs/meson-log.txt
- name: unit tests
run: meson test -C build "libvfn:"
- name: upload log
uses: actions/upload-artifact@v3
if: failure()
with:
name: meson test log
path: build/meson-logs/testlog.txt
nix-tests:
name: "nix build"
needs: [sanity]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: install nix
uses: DeterminateSystems/nix-installer-action@main
- name: init cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: build package
run: nix build .
device-test:
name: "run emulated nvme device tests"
needs: [sanity]
strategy:
max-parallel: 1
fail-fast: false
matrix:
machine:
- {os: "fedora", image: "38", kernel: "default"}
- {os: "fedora", image: "rawhide", kernel: "iommufd"}
runs-on: [self-hosted, kvm]
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || ((github.event_name == 'pull_request') && contains(github.event.pull_request.labels.*.name, 'approved'))
env:
VMCTL_VMROOT: "/scratch/ghr/guests"
KERNEL_DIR: "/scratch/ghr/src/linux"
GUEST_BOOT: "img/fedora-${{ matrix.machine.image }}.qcow2"
VMCONFIG: ".github/vmconfig/nvme.conf"
QEMU_SYSTEM_BINARY: "/usr/bin/qemu-system-x86_64"
NVME_PCI_DEV: "0000:00:03.0"
steps:
- name: checkout libvfn
uses: actions/checkout@v4
- name: create dist package
run: |
meson setup build
meson dist -C build --no-tests
- name: reset vm
run: |
vmctl -c "$VMCONFIG" kill || true
- name: launch vm
if: matrix.machine.kernel == 'default'
run: |
vmctl -c "$VMCONFIG" run --background
vmctl -c "$VMCONFIG" ssh -w -- echo vm is up
- name: launch vm (custom kernel)
if: matrix.machine.kernel == 'iommufd'
run: |
vmctl -c "$VMCONFIG" run -k "$KERNEL_DIR" --background
vmctl -c "$VMCONFIG" ssh -w -- echo vm is up
- name: copy source
run: |
eval $(vmctl -c "$VMCONFIG" vars | grep -E '^GUEST_SSH_PORT=')
scp -P "$GUEST_SSH_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null build/meson-dist/libvfn-*.tar.xz root@localhost:
- name: build
run: |
vmctl -c "$VMCONFIG" ssh -- -T <<EOF
mkdir libvfn
tar -Jxf libvfn-*.tar.xz -C libvfn --strip 1
cd libvfn
meson setup build
ninja -C build
EOF
- name: setup device
run: |
vmctl -c "$VMCONFIG" ssh -- -T <<EOF
modprobe vfio-pci
cd libvfn
./build/tools/vfntool/vfntool -v -d "$NVME_PCI_DEV"
EOF
- name: run tests
run: |
vmctl -c "$VMCONFIG" ssh -- -T <<EOF
cd libvfn
meson test -C build libvfn: --suite device --test-args "-d \"${NVME_PCI_DEV}\" -N 1"
EOF
- name: shutdown vm
if: always()
run: vmctl -c "$VMCONFIG" kill