Skip to content

Commit 10672d1

Browse files
committed
CI: split QEMU installer to hack/install-qemu.sh
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
1 parent 5839d36 commit 10672d1

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,8 @@ jobs:
315315
- name: Install test dependencies
316316
run: |
317317
sudo apt-get update
318-
sudo apt-get install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils w3m
319-
sudo modprobe kvm
320-
# `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
321-
sudo chown $(whoami) /dev/kvm
318+
sudo ./hack/install-qemu.sh
319+
sudo apt-get install -y --no-install-recommends w3m
322320
- name: Install ansible-playbook
323321
run: |
324322
sudo apt-get install -y --no-install-recommends ansible
@@ -360,10 +358,7 @@ jobs:
360358
- name: Install test dependencies
361359
run: |
362360
sudo apt-get update
363-
sudo apt-get install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils
364-
sudo modprobe kvm
365-
# `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
366-
sudo chown $(whoami) /dev/kvm
361+
sudo ./hack/install-qemu.sh
367362
- name: Cache image used by templates/default.yaml
368363
uses: ./.github/actions/setup_cache_for_template
369364
with:
@@ -407,10 +402,7 @@ jobs:
407402
- name: Install test dependencies
408403
run: |
409404
sudo apt-get update
410-
sudo apt-get install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils
411-
sudo modprobe kvm
412-
# `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
413-
sudo chown $(whoami) /dev/kvm
405+
sudo ./hack/install-qemu.sh
414406
- name: "Show cache"
415407
run: ./hack/debug-cache.sh
416408
- name: "Test"
@@ -615,10 +607,6 @@ jobs:
615607
- name: Install test dependencies
616608
run: |
617609
sudo apt-get update
618-
sudo apt-get install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils
619-
qemu-system-x86_64 --version
620-
sudo modprobe kvm
621-
# `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
622-
sudo chown $(whoami) /dev/kvm
610+
sudo ./hack/install-qemu.sh
623611
- name: Smoke test
624612
run: limactl start --tty=false

hack/install-qemu.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
# SPDX-FileCopyrightText: Copyright The Lima Authors
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# Install qemu on GitHub Actions runner.
7+
# Not expected to be used outside GitHub Actions.
8+
9+
set -eux
10+
11+
# apt-get update has to be run beforehand
12+
apt-get install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils
13+
modprobe kvm
14+
# `usermod -aG kvm ${SUDO_USER}` does not take an effect on GHA
15+
chown "${SUDO_USER}" /dev/kvm
16+
qemu-system-x86_64 --version

0 commit comments

Comments
 (0)