Files
steamify-cachyos/.github/actions/vm-runner/action.yml
T

38 lines
1.7 KiB
YAML

name: VM runner
description: KVM, qemu, the big disk for the VMs, the package cache and the cached Steamify ISO (at /mnt/work/iso/steamify.iso)
inputs:
iso-tag:
description: The Steamify ISO release the iso job cached
required: true
runs:
using: composite
steps:
- name: KVM, qemu, disk
shell: bash
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules && sudo udevadm trigger --name-match=kvm && sudo udevadm settle || true
for _ in $(seq 10); do [ -w /dev/kvm ] && break; sleep 1; done
ls -l /dev/kvm 2>&1 || true
grep -cE 'vmx|svm' /proc/cpuinfo || true
[ -w /dev/kvm ] || { echo "::error::no usable /dev/kvm on this runner (some GitHub runners have none: re-run the job)"; exit 1; }
sudo apt-get update -qq
sudo apt-get install -y -qq qemu-system-x86 qemu-utils ovmf libarchive-tools openssh-client
# The VMs and the ISO on /mnt (the big disk); ~/vms points there.
sudo mkdir -p /mnt/work && sudo chown "$USER" /mnt/work
mkdir -p /mnt/work/vms/pkg-cache /mnt/work/iso "$HOME/.ssh" && ln -s /mnt/work/vms "$HOME/vms"
ssh-keygen -q -t ed25519 -N "" -C steamify-vm -f "$HOME/.ssh/steamify-vm_ed25519"
nproc; free -g | sed -n 2p; df -h /mnt | tail -n 1
- name: Cache - the VMs' packages
uses: actions/cache@v4
with:
path: /mnt/work/vms/pkg-cache
key: vmpkg-${{ github.run_id }}
restore-keys: vmpkg-
- name: Cache - the ISO (from the iso job)
uses: actions/cache/restore@v4
with:
path: /mnt/work/iso
key: steamify-iso-${{ inputs.iso-tag }}
fail-on-cache-miss: true