forked from pmem/run_qemu
-
Notifications
You must be signed in to change notification settings - Fork 0
305 lines (264 loc) · 9.94 KB
/
main.yml
File metadata and controls
305 lines (264 loc) · 9.94 KB
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
294
295
296
297
298
299
300
301
302
303
304
305
---
name: CXL test runner
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
inputs:
kernel_repo:
description: "Kernel repo: owner/name OR full git URL"
required: true
default: "AlisonSchofield/linux-kernel"
kernel_branch:
description: "Kernel branch (or tag/SHA)"
required: true
default: "cxl-testme"
ndctl_repo:
description: "ndctl repo: owner/name OR full git URL"
required: true
default: "pmem/ndctl"
ndctl_branch:
description: "ndctl branch (or tag/SHA)"
required: true
default: "pending"
timeout_min:
description: "Guest timeout (minutes)"
required: true
default: "35"
jobs:
build:
runs-on: ubuntu-24.04
env:
# Inputs
KERNEL_REPO: ${{ inputs.kernel_repo }}
KERNEL_BRANCH: ${{ inputs.kernel_branch }}
NDCTL_REPO: ${{ inputs.ndctl_repo }}
NDCTL_BRANCH: ${{ inputs.ndctl_branch }}
RUN_TIMEOUT_MIN: ${{ inputs.timeout_min }}
# Pinned runner behavior (not user-configurable ATM)
RUN_OPTS: --cxl-test-run --ndctl-build
# Pinned image selection
MKOSI_DISTRO: ubuntu
MKOSI_RELEASE: noble
# Pinned runner identity strings (for output / cache keys)
RUNNER_OS_LABEL: ubuntu-24.04
ARCH_LABEL: x86_64
steps:
- name: checkout run_qemu (this repo)
uses: actions/checkout@v4
with:
path: run_qemu
# Freeing disk space takes time. Check if needed.
- name: check free disk space
id: disk
shell: bash
run: |
set -euo pipefail
avail=$(df --output=avail -BG / | tail -1 | tr -dc '0-9')
echo "available_gb=$avail" >> "$GITHUB_OUTPUT"
echo "Free space: ${avail}G"
df -h
# Free disk space on GitHub runner
- name: apt-get remove for disk space
if: ${{ steps.disk.outputs.available_gb < 20 }}
run: |
df -h
sudo apt-get remove -y '^aspnetcore-.*' '^dotnet-.*'
sudo apt-get remove -y 'php.*' '^mongodb-.*' '^mysql-.*'
sudo apt-get remove -y azure-cli '^google-cloud*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get autoremove -y
sudo apt-get install -y bc
df -h
- name: rm -rf for disk space
if: ${{ steps.disk.outputs.available_gb < 20 }}
run: |
df -h
sudo docker image prune --all --force || true
df -h
_dirs=( /usr/local/lib/android /usr/share/dotnet /usr/local/.ghcup )
sudo du -shc "${_dirs[@]}" || true
sudo rm -rf "${_dirs[@]}"
df -h
- name: apt install mkosi and run_qemu requirements
run: |
sudo apt-get update
# Kernel build deps
sudo apt install -y build-essential flex bison libelf-dev libssl-dev ccache
# run_qemu deps
sudo apt install -y mkosi
sudo apt install -y dracut-core qemu-utils ovmf mtools qemu-system-x86
pip3 install qemu.qmp
- name: mkosi v20 fixes on Ubuntu 24.04
run: |
cd /usr/lib/python3/dist-packages
sudo git apply "${{ github.workspace }}/run_qemu/Patches/ubuntu/24.04/mkosi/"*.patch
- name: apt install Ubuntu 24.04 requirements for mkosi
run: |
sudo apt install -y systemd-ukify systemd-boot
- name: apt install ndctl build dependencies
run: |
grep -vE '^[[:blank:]]*#' .github/workflows/ubuntu-ndctl-build-deps | \
xargs sudo apt install -y
- name: argbash
run: |
AB_VER=2.10.0
wget https://github.com/matejak/argbash/archive/refs/tags/${AB_VER}.tar.gz
tar xf ${AB_VER}.tar.gz
sudo apt install -y autoconf
sudo make -C argbash-${AB_VER}/resources install PREFIX=/usr/local/
- name: set week number for caches
id: weeks
run: |
printf 'now=%s\n' "$(date +%Y-w%U)" >> "$GITHUB_OUTPUT"
printf 'previous=%s\n' "$(date +%Y-w%U -d '7 days ago')" >> "$GITHUB_OUTPUT"
- name: compute cache key suffixes
id: cachekeys
shell: bash
run: |
set -euo pipefail
k="$(printf '%s\n' "$KERNEL_REPO@$KERNEL_BRANCH" | sha256sum | awk '{print $1}')"
n="$(printf '%s\n' "$NDCTL_REPO@$NDCTL_BRANCH" | sha256sum | awk '{print $1}')"
echo "kernel_key=$k" >> "$GITHUB_OUTPUT"
echo "ndctl_key=$n" >> "$GITHUB_OUTPUT"
- name: Fetch ccache
uses: actions/cache@v4
with:
path: ~/.cache/ccache/
key: ccache_${{ env.RUNNER_OS_LABEL }}_${{ env.ARCH_LABEL }}_${{ steps.cachekeys.outputs.kernel_key }}_${{ steps.weeks.outputs.now }}
restore-keys: |
ccache_${{ env.RUNNER_OS_LABEL }}_${{ env.ARCH_LABEL }}_${{ steps.cachekeys.outputs.kernel_key }}_${{ steps.weeks.outputs.previous }}
ccache_${{ env.RUNNER_OS_LABEL }}_${{ env.ARCH_LABEL }}_${{ steps.cachekeys.outputs.kernel_key }}
ccache_${{ env.RUNNER_OS_LABEL }}_${{ env.ARCH_LABEL }}
- name: ensure clean checkout dirs
shell: bash
run: |
set -euo pipefail
rm -rf ndctl kernel
# Checkout that supports either "owner/name" OR full git URL.
- name: checkout ndctl
shell: bash
run: |
set -euo pipefail
if [[ "$NDCTL_REPO" =~ ^https?://|^git://|^ssh://|^git@ ]]; then
git clone --depth 1 --branch "$NDCTL_BRANCH" "$NDCTL_REPO" ndctl
else
git clone --depth 1 --branch "$NDCTL_BRANCH" "https://github.com/${NDCTL_REPO}.git" ndctl
fi
- name: checkout kernel
shell: bash
run: |
set -euo pipefail
export GIT_LFS_SKIP_SMUDGE=1
if [[ "$KERNEL_REPO" =~ ^https?://|^git://|^ssh://|^git@ ]]; then
git -c submodule.recurse=false clone \
--depth 1 --single-branch \
--branch "$KERNEL_BRANCH" \
"$KERNEL_REPO" kernel
else
git -c submodule.recurse=false clone \
--depth 1 --single-branch \
--branch "$KERNEL_BRANCH" \
"https://github.com/${KERNEL_REPO}.git" kernel
fi
- name: show revisions under test
run: |
echo "Kernel repo: $KERNEL_REPO"
echo "Kernel branch: $KERNEL_BRANCH"
git -C kernel rev-parse HEAD
git -C kernel log -1 --oneline
echo
echo "ndctl repo: $NDCTL_REPO"
echo "ndctl branch: $NDCTL_BRANCH"
git -C ndctl rev-parse HEAD
git -C ndctl log -1 --oneline
echo
echo "Runner: $RUNNER_OS_LABEL"
echo "Arch: $ARCH_LABEL"
echo "mkosi image: $MKOSI_DISTRO $MKOSI_RELEASE"
echo "run_qemu opts: $RUN_OPTS"
echo "timeout (min): $RUN_TIMEOUT_MIN"
- name: defconfig
working-directory: ${{ github.workspace }}/kernel
run: |
make defconfig ARCH=x86_64
bash ./scripts/kconfig/merge_config.sh .config ../run_qemu/.github/workflows/cxl-test.cfg
make olddefconfig ARCH=x86_64
- name: disable AppArmor
run: |
if test -e /proc/sys/kernel/apparmor_restrict_unprivileged_unconfined; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
- name: run_qemu.sh
run: |
set -x
mkosi --version
qemu-system-x86_64 --version || true
which qemu-system-x86_64 || true
ccache --show-stats
cp run_qemu/contrib/tmpfs_workspace.tmpl run_qemu/mkosi_tmpl_portable/
rm -f /tmp/rq_0.log
touch /tmp/rq_0.log
chmod a+rw /tmp/rq_0.log
cd kernel
(
PATH=/usr/lib/ccache:"$PATH" \
distro=${MKOSI_DISTRO} rev=${MKOSI_RELEASE} \
ndctl='${{ github.workspace }}/ndctl' \
../run_qemu/run_qemu.sh ${RUN_OPTS} \
--rebuild=kmod \
--no-kvm \
--timeout=${RUN_TIMEOUT_MIN} \
--debug
) 2>&1 | tee -a /tmp/rq_0.log
exit ${PIPESTATUS[0]}
- name: failure triage snapshot
if: ${{ always() }}
shell: bash
run: |
set +e
echo "=== df -h ==="
df -h
echo
echo "=== free -h ==="
free -h
echo
echo "=== dmesg tail ==="
dmesg | tail -n 200 || true
echo
echo "=== last 200 lines of /tmp/rq_0.log ==="
tail -n 200 /tmp/rq_0.log 2>/dev/null || true
- name: check if qemu died early
if: ${{ always() }}
run: |
echo "=== qemu processes ==="
ps -ef | grep -v grep | grep qemu-system-x86_64 || echo "no qemu process"
echo "=== QMP socket ==="
ls -la /tmp/run_qemu_qmp_0 || true
- name: show bios and serial logs
if: ${{ always() }}
run: |
echo "=== /tmp/rq_0.log tail ==="
tail -n 200 /tmp/rq_0.log || true
echo "=== bios_debug.log ==="
tail -n 200 kernel/bios_debug.log 2>/dev/null || tail -n 200 bios_debug.log 2>/dev/null || true
- name: CXL unit test run results
if: always()
run: |
echo "==== CXL unit test run results ===="
sed -e 's/^\[[^]]*\] //' -e 's/\r$//' /tmp/rq_0.log \
| awk '/^======= meson-test.log ========/{p=1} p; /^======= Done \/usr\/local\/bin\/rq_cxl_tests.sh ========/{p=0}'
- name: upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: logs
if-no-files-found: warn
path: |
/tmp/rq_0.log
kernel/bios_debug.log
bios_debug.log
- name: ccache stats
run: |
ccache --show-stats
ccache --show-config | grep dir || true