(mistaken debug push, ignore) #524
This file contains hidden or 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: examples | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 45 | |
strategy: | |
matrix: | |
example: | |
# Temporarily disabled for faster debugging | |
# - { dir: 'bls', os: 'arch' } | |
# - { dir: 'bls', os: 'fedora' } | |
# - { dir: 'bls', os: 'fedora-compat' } | |
# - { dir: 'bls', os: 'rawhide' } | |
# - { dir: 'bls', os: 'rhel9' } | |
# - { dir: 'bls', os: 'ubuntu' } | |
# - { dir: 'uki', os: 'arch' } | |
- { dir: 'uki', os: 'fedora' } | |
# - { dir: 'unified', os: 'fedora' } | |
# - { dir: 'unified-secureboot', os: 'fedora' } | |
# - { dir: 'bls', os: 'arch', fsfmt: 'ext4', verity: 'none' } | |
# - { dir: 'bls', os: 'arch', fsfmt: 'xfs', verity: 'none' } | |
fail-fast: false | |
steps: | |
- name: Enable fs-verity on / | |
run: sudo tune2fs -O verity $(findmnt -vno SOURCE /) | |
- name: Setup /dev/kvm | |
run: | | |
set -eux | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm.rules | |
echo 'KERNEL=="vhost-vsock", GROUP="kvm", MODE="0666", OPTIONS+="static_node=vhost-vsock"' | sudo tee /etc/udev/rules.d/99-vhost-vsock.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --settle | |
ls -l /dev/kvm /dev/vhost-vsock | |
- name: Install dependencies | |
run: | | |
echo 'deb-src http://azure.archive.ubuntu.com/ubuntu noble main' | sudo tee /etc/apt/sources.list.d/debsrc.list | |
sudo apt-get update | |
sudo apt-get install -y \ | |
erofs-utils \ | |
fsverity \ | |
mtools \ | |
python3-pytest-asyncio \ | |
qemu-kvm \ | |
systemd-boot-efi | |
- name: Get a newer podman for heredoc support (from plucky) | |
run: | | |
echo 'deb http://azure.archive.ubuntu.com/ubuntu plucky universe main' | sudo tee /etc/apt/sources.list.d/plucky.list | |
sudo apt update | |
sudo apt install -y crun/plucky podman/plucky | |
- uses: actions/checkout@v4 | |
- name: Check cache for patched tools | |
uses: actions/cache@v3 | |
with: | |
path: ~/bin | |
key: patched-tools-bin-${{ hashFiles('examples/common/install-patched-tools') }} | |
- name: Ensure patched tools are installed | |
run: | | |
set -eux | |
if [ ! -x "$HOME/bin/mkfs.ext4" ]; then | |
sudo apt-get build-dep systemd e2fsprogs | |
mkdir ~/bin | |
examples/common/install-patched-tools ~/bin | |
fi | |
- name: Install systemd-ssh-proxy polyfill | |
run: sudo cp examples/bls/test-thing.workarounds/systemd-ssh-proxy /usr/lib/systemd | |
- name: Run example tests | |
id: run_tests | |
continue-on-error: true | |
run: | | |
export PATH="${HOME}/bin:${PATH}" | |
export FS_FORMAT=${{ matrix.example.fsfmt }} | |
export FS_VERITY_MODE=${{ matrix.example.verity }} | |
examples/test/run ${{ matrix.example.dir }} ${{ matrix.example.os }} | |
- name: Dump console logs on failure | |
if: steps.run_tests.outcome == 'failure' | |
run: | | |
echo "=== Test.thing directories ===" | |
ls -laR /run/user/$(id -u)/test.thing/ 2>/dev/null || true | |
echo "" | |
echo "=== Console logs from failed VMs ===" | |
find /run/user/$(id -u)/test.thing -name console -type f 2>/dev/null | while read console; do | |
echo "==== Console from $console ====" | |
cat "$console" || true | |
echo "" | |
done | |
echo "=== QEMU logs from failed VMs ===" | |
find /run/user/$(id -u)/test.thing -name qemu.log -type f 2>/dev/null | while read qemu_log; do | |
echo "==== QEMU log from $qemu_log ====" | |
cat "$qemu_log" || true | |
echo "" | |
done | |
echo "=== Serial logs from failed VMs ===" | |
find /run/user/$(id -u)/test.thing -name serial.log -type f 2>/dev/null | while read serial_log; do | |
echo "==== Serial log from $serial_log ====" | |
cat "$serial_log" || true | |
echo "" | |
done | |
echo "=== SSH debug logs from failed VMs ===" | |
find /run/user/$(id -u)/test.thing -name ssh.log -type f 2>/dev/null | while read ssh_log; do | |
echo "==== SSH log from $ssh_log ====" | |
cat "$ssh_log" || true | |
echo "" | |
done | |
echo "=== QMP sockets ===" | |
find /run/user/$(id -u)/test.thing -name qmp -type s 2>/dev/null || true | |
- name: Check vsock device permissions | |
if: steps.run_tests.outcome == 'failure' | |
run: | | |
echo "=== vsock device status ===" | |
ls -la /dev/vhost-vsock /dev/kvm || true | |
echo "" | |
echo "=== vsock kernel module ===" | |
lsmod | grep vsock || true | |
echo "" | |
echo "=== Test vsock connection ===" | |
python3 -c "import socket; sock = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM); print('vsock socket created successfully')" || echo "Failed to create vsock socket" | |
- name: Capture test.thing runtime directory | |
if: steps.run_tests.outcome == 'failure' | |
run: | | |
echo "=== test.thing IPC directory contents ===" | |
find /run/user/$(id -u)/test.thing -ls 2>/dev/null || true | |
- name: Show build artifacts for debugging | |
if: steps.run_tests.outcome == 'failure' | |
run: | | |
cd examples/${{ matrix.example.dir }} | |
echo "=== Boot directory contents ===" | |
find tmp/efi -ls 2>/dev/null || true | |
echo "" | |
echo "=== Sysroot composefs images ===" | |
ls -lh tmp/sysroot/composefs/images/ 2>/dev/null || true | |
echo "" | |
echo "=== Sysroot state deployments ===" | |
ls -lh tmp/sysroot/state/deploy/ 2>/dev/null || true | |
- name: Fail job if tests failed | |
if: steps.run_tests.outcome == 'failure' | |
run: exit 1 |