Merge pull request #85 from KaiNorberg/develop #318
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: Build and Test | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| jobs: | |
| build_and_test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: trues | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential nasm qemu-system-x86 mtools iasl | |
| - name: Setup PatchworkOS | |
| run: make setup DEBUG=1 TESTING=1 QEMU_EXIT_ON_PANIC=1 | |
| - 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: | # We use this cheap trick to check if qemu runs properly, the idea is that we start qemu, and let it run for one minute and it does not crash thats considered a success, if it crashes, well thats bad. If it doesent we shut it down and call it a success, a bit simple but gets the job done. | |
| setsid make run DEBUG=1 TESTING=1 QEMU_EXIT_ON_PANIC=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 |