Skip to content

Commit 905b7cb

Browse files
authored
ci: add manual+PR KVM ARM64 runner probe (#177)
Mirrors the macOS virtualization probe for the Tart/Ubuntu KVM runners. Verifies arm64 Linux, /dev/kvm presence+rw, and kvm-ok verdict. pull_request trigger is path-scoped to this file so it only runs when changed. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent deabc97 commit 905b7cb

1 file changed

Lines changed: 120 additions & 0 deletions

File tree

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
# Manual probe: confirm the Tart/Ubuntu KVM runner actually exposes nested
4+
# virtualization inside the guest VM.
5+
#
6+
# This mirrors the macOS virtualization probe in spirit: it checks the runner
7+
# identity, asserts the expected ARM64/Linux environment, and fails if /dev/kvm
8+
# or kvm-ok are not available.
9+
10+
name: Check KVM ARM64 Runner
11+
12+
on:
13+
workflow_dispatch:
14+
# Path-scoped so it only runs on PRs that touch this probe, not every PR.
15+
pull_request:
16+
paths:
17+
- .github/workflows/check-kvm-arm64.yml
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
check-kvm:
24+
name: Inspect KVM on Tart ARM64 Linux runner
25+
runs-on: [self-hosted, arm64, kvm, linux, ubuntu-24.04]
26+
27+
steps:
28+
- name: Report runner identity
29+
id: identity
30+
run: |
31+
os_name="$(uname -s)"
32+
os_release="$(uname -r)"
33+
arch="$(uname -m)"
34+
kernel="$(uname -srv)"
35+
cpu_brand="$(lscpu 2>/dev/null | awk -F: '/^Model name/ {print $2}' | xargs || true)"
36+
37+
echo "::group::Runner identity"
38+
echo "OS: ${os_name} ${os_release}"
39+
echo "Architecture: ${arch}"
40+
echo "Kernel: ${kernel}"
41+
echo "CPU brand: ${cpu_brand}"
42+
echo "::endgroup::"
43+
44+
{
45+
echo "os_name=${os_name}"
46+
echo "os_release=${os_release}"
47+
echo "arch=${arch}"
48+
echo "cpu_brand=${cpu_brand}"
49+
} >> "$GITHUB_OUTPUT"
50+
51+
- name: Assert ARM64 Linux guest
52+
run: |
53+
arch="$(uname -m)"
54+
if [ "$arch" != "aarch64" ] && [ "$arch" != "arm64" ]; then
55+
echo "::error::Expected arm64/aarch64 runner, got '$arch'"
56+
exit 1
57+
fi
58+
echo "Confirmed ARM64 Linux runner."
59+
60+
- name: Verify /dev/kvm is present and usable
61+
id: kvm_device
62+
run: |
63+
if [ ! -e /dev/kvm ]; then
64+
echo "::error::/dev/kvm is missing on this runner"
65+
exit 1
66+
fi
67+
68+
ls -l /dev/kvm
69+
stat -c 'mode=%a owner=%U group=%G' /dev/kvm
70+
71+
if [ ! -r /dev/kvm ] || [ ! -w /dev/kvm ]; then
72+
echo "::error::/dev/kvm exists but is not readable/writable by this user"
73+
exit 1
74+
fi
75+
76+
echo "kvm_present=true" >> "$GITHUB_OUTPUT"
77+
78+
- name: Verify kvm-ok is available and reports KVM
79+
id: kvm_ok
80+
run: |
81+
if ! command -v kvm-ok >/dev/null 2>&1; then
82+
echo "::error::kvm-ok not found on PATH"
83+
exit 1
84+
fi
85+
86+
echo "Found kvm-ok: $(command -v kvm-ok)"
87+
set +e
88+
kvm-ok
89+
rc=$?
90+
set -e
91+
92+
case "$rc" in
93+
0)
94+
echo "kvm_ok=true" >> "$GITHUB_OUTPUT"
95+
echo "kvm_ok_status=ok" >> "$GITHUB_OUTPUT"
96+
echo "KVM acceleration is available on this runner."
97+
;;
98+
*)
99+
echo "kvm_ok=false" >> "$GITHUB_OUTPUT"
100+
echo "kvm_ok_status=failed-${rc}" >> "$GITHUB_OUTPUT"
101+
echo "::error::kvm-ok failed with exit code $rc"
102+
exit 1
103+
;;
104+
esac
105+
106+
- name: Summary
107+
if: always()
108+
run: |
109+
{
110+
echo "### Tart KVM runner check"
111+
echo ""
112+
echo "| Property | Value |"
113+
echo "| --- | --- |"
114+
echo "| Runner label set | self-hosted, arm64, kvm, linux, ubuntu-24.04 |"
115+
echo "| OS | ${{ steps.identity.outputs.os_name }} ${{ steps.identity.outputs.os_release }} |"
116+
echo "| Architecture | ${{ steps.identity.outputs.arch }} |"
117+
echo "| CPU | ${{ steps.identity.outputs.cpu_brand || 'unknown' }} |"
118+
echo "| /dev/kvm present | ${{ steps.kvm_device.outputs.kvm_present || 'false' }} |"
119+
echo "| kvm-ok verdict | ${{ steps.kvm_ok.outputs.kvm_ok || 'not-run' }} (${{ steps.kvm_ok.outputs.kvm_ok_status || 'n/a' }}) |"
120+
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)