Skip to content

Develop

Develop #409

Workflow file for this run

name: Build and Test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build_and_test:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang llvm build-essential qemu-system-x86 mtools iasl
- name: Build PatchworkOS
run: make all DEBUG=1 TESTING=1 QEMU_EXIT_ON_PANIC=1
- name: Verify PatchworkOS.img exists
run: |
if [ ! -f bin/PatchworkOS.img ]; then
echo "Error: bin/PatchworkOS.img not found after build!"
exit 1
fi
- name: Run PatchworkOS with QEMU (test launch and graceful timeout)
id: qemu_test
run: |
setsid make run DEBUG=1 TESTING=1 QEMU_EXIT_ON_PANIC=1 QEMU_NOGRAPHIC=1 &
QEMU_PID=$!
echo "QEMU process started with PID=$QEMU_PID"
echo "QEMU_PID=$QEMU_PID" >> $GITHUB_OUTPUT
echo "Leting QEMU run for a bit..."
sleep 120
if ps -p $QEMU_PID > /dev/null
then
echo "QEMU is still running, indicating no error."
echo "Killing QEMU process (PID: $QEMU_PID)..."
kill $QEMU_PID
if ps -p $QEMU_PID > /dev/null
then
echo "QEMU process (PID=$QEMU_PID) did not terminate, forcing kill."
kill -9 $QEMU_PID
fi
exit 0
else
echo "QEMU process (PID=$QEMU_PID) terminated unexpectedly, assuming kernel panicked."
exit 1
fi