Skip to content

Test build quickemu 🚧 #27

Test build quickemu 🚧

Test build quickemu 🚧 #27

name: Test build quickemu 🚧
on:
pull_request:
branches:
- master
paths:
- quickemu
- quickget
- debian/**
- flake.nix
- package.nix
push:
branches:
- master
paths:
- quickemu
- quickget
- debian/**
- flake.nix
- package.nix
workflow_dispatch:
# TODO: arm64 runner
# https://github.blog/changelog/2024-06-03-actions-arm-based-linux-and-windows-runners-are-now-in-public-beta/
jobs:
test-deb-build:
runs-on: ubuntu-22.04
steps:
- name: "Checkout 🥡"
uses: actions/checkout@v4
- name: "Build & Test .deb 🍥"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sudo apt-get -y update
sudo apt-get -y install debhelper devscripts
REL_VER=$(grep "^readonly VERSION" quickemu | cut -d'"' -f2)
rm debian/changelog
dch --package quickemu --newversion="${REL_VER}-1" --distribution=unstable "New upstream release." --create
dpkg-buildpackage --build=binary --no-check-builddeps --compression=gzip
sudo apt-get -y install ../quickemu_${REL_VER}-1_all.deb
quickemu --help
quickget --help
test-nix-build:
runs-on: ubuntu-22.04
permissions:
id-token: "write"
contents: write
actions: read
checks: write
steps:
- name: "Checkout 🥡"
uses: "actions/checkout@v4"
- name: "Install Nix ❄️"
uses: "DeterminateSystems/nix-installer-action@v12"
- name: "Enable Magic Nix Cache 🪄"
uses: "DeterminateSystems/magic-nix-cache-action@v7"
- name: "Build & Test .nix ❄️"
run: |
nix build .#quickemu
tree ./result
./result/bin/quickemu --help
./result/bin/quickget --help
./result/bin/quickreport
# Text a VM if the Nix Installer successfully enabled KVM
if [ $DETERMINATE_NIX_KVM -eq 1 ]; then
./result/bin/quickget alpine v3.20
./result/bin/quickemu --vm alpine-v3.20.conf --display none
sleep 5
if pgrep -F ./alpine-v3.20/alpine-v3.20.pid; then
echo "Test VM is running"
echo "Waiting a few seconds before capturing a screenshot"
sleep 5
./result/bin/quickemu --vm alpine-v3.20.conf --monitor-cmd "screendump test.ppm"
nix shell nixpkgs#imagemagick -c convert test.ppm test.png
else
echo "Test VM is not running"
exit 1
fi
# Test a few more quickemu commands to clean up
./result/bin/quickemu --vm alpine-v3.20.conf --kill
./result/bin/quickemu --vm alpine-v3.20.conf --delete-disk
./result/bin/quickemu --vm alpine-v3.20.conf --delete-all
fi
- name: Upload test results 📸
if: ${{ success() }}
uses: edunad/[email protected]
with:
path: './test.png'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
title: 'Screenshot of test VM'