Skip to content

Commit 8e8ef96

Browse files
committed
ci: add a qemu/arm64 VM to GH workflows
Signed-off-by: Ramkumar Chinchani <[email protected]>
1 parent 0cbd6f6 commit 8e8ef96

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/qemu.yaml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: QEMU environment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
release:
11+
types:
12+
- published
13+
14+
jobs:
15+
setup:
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Install dependencies
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install -y qemu-system-arm qemu-efi-aarch64 qemu-utils cloud-image-utils wget
22+
23+
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-arm64.img
24+
25+
qemu-img create -f qcow2 -F qcow2 \
26+
-b jammy-server-cloudimg-arm64.img \
27+
jammy-snapshot.qcow2 200G
28+
29+
cat >"user-data" << EOF
30+
#cloud-config
31+
password: passw0rd
32+
chpasswd: { expire: False }
33+
ssh_pwauth: True
34+
EOF
35+
cloud-localds user-data.img user-data
36+
37+
cp /usr/share/AAVMF/AAVMF_CODE.fd .
38+
cp /usr/share/AAVMF/AAVMF_VARS.fd .
39+
40+
randmac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/:$//')
41+
42+
qemu-system-aarch64 \
43+
-m 2048 \
44+
-cpu max -smp 4 \
45+
-machine virt,gic-version=max \
46+
-nographic \
47+
-drive if=pflash,format=raw,readonly=on,file=AAVMF_CODE.fd \
48+
-drive if=pflash,format=raw,file=AAVMF_VARS.fd \
49+
-drive if=none,file=jammy-server-cloudimg-arm64.img,id=hd0 \
50+
-drive file=user-data.img,format=raw \
51+
-device virtio-blk-device,drive=hd0 \
52+
-netdev type=user,id=net0,hostfwd=tcp::22225-:22 \
53+
-device virtio-net-device,netdev=net0,mac=$randmac
54+
wait:
55+
runs-on: ubuntu-22.04
56+
steps:
57+
- name: Install dependencies
58+
run: |
59+
sudo apt-get update
60+
sudo apt-get install -y sshpass
61+
- name: Check with ssh
62+
continue-on-error: true
63+
run: |
64+
while true; do
65+
echo Trying to connect
66+
sshpass -p passw0rd ssh -v -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P 22225 ubuntu@localhost whoami
67+
if [ $? -eq 0 ]; then
68+
break
69+
fi
70+
done

0 commit comments

Comments
 (0)