ci: run KVM tests on GitHub runners #1120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
merge_group: | |
env: | |
GH_TOKEN: ${{ github.token }} | |
RUSTFLAGS: -Dwarnings | |
RUSTDOCFLAGS: -Dwarnings | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
run-kvm: | |
name: Run (KVM) | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Install QEMU | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu-system-x86 cpu-checker --no-install-recommends | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- run: kvm-ok | |
# - run: grep -cw vmx /proc/cpuinfo | |
- run: sudo setfacl -m u:${USER}:rw /dev/kvm | |
- run: | | |
[ -r /dev/kvm ] && [ -w /dev/kvm ] && echo "OK" || echo "FAIL" | |
- run: git lfs pull | |
- run: git lfs checkout | |
- name: Install firecracker | |
run: | | |
# https://github.com/firecracker-microvm/firecracker/blob/v1.5.1/docs/getting-started.md#getting-a-firecracker-binary | |
ARCH="$(uname -m)" | |
release_url="https://github.com/firecracker-microvm/firecracker/releases" | |
latest=$(basename $(curl -fsSLI -o /dev/null -w %{url_effective} ${release_url}/latest)) | |
curl -L ${release_url}/download/${latest}/firecracker-${latest}-${ARCH}.tgz \ | |
| tar -xz | |
mkdir -p $HOME/.local/bin | |
mv release-${latest}-$(uname -m)/firecracker-${latest}-${ARCH} $HOME/.local/bin/firecracker | |
echo $HOME/.local/bin >> $GITHUB_PATH | |
$HOME/.local/bin/firecracker --version | |
- name: Download OVMF | |
run: | | |
gh release download edk2-stable202408-r1 --repo rust-osdev/ovmf-prebuilt --pattern 'edk2-stable*-bin.tar.xz' | |
tar -xvf edk2-stable*-bin.tar.xz edk2-stable202408-r1-bin/x64 | |
- uses: dtolnay/rust-toolchain@stable | |
# - name: Run QEMU (hello_world, dev) | |
# run: cargo xtask ci qemu --target x86_64 --accel --sudo | |
# - name: Run QEMU (hello_world, release) | |
# run: cargo xtask ci qemu --target x86_64 --accel --sudo --release | |
# - name: Run QEMU (hello_world-microvm, dev) | |
# run: cargo xtask ci qemu --target x86_64 --accel --microvm --sudo | |
# - name: Run QEMU (hello_world-microvm, release) | |
# run: cargo xtask ci qemu --target x86_64 --accel --microvm --sudo --release | |
# - name: Run UEFI (dev) | |
# run: cargo xtask ci qemu --target x86_64-uefi --accel --sudo | |
# - name: Run UEFI (release) | |
# run: cargo xtask ci qemu --target x86_64-uefi --accel --sudo --release | |
- name: Run Firecracker (hello_world, dev) | |
run: FIRECRACKER=$HOME/.local/bin/firecracker cargo xtask ci firecracker --target x86_64-fc --sudo | |
continue-on-error: true | |
- name: Run Firecracker (hello_world, release) | |
run: FIRECRACKER=$HOME/.local/bin/firecracker cargo xtask ci firecracker --target x86_64-fc --sudo --release |