Use matrix strategy in CI and fix integration test for BCM2835

Co-authored-by: jbltx <1284323+jbltx@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-12 19:02:52 +00:00
co-authored by jbltx
parent b9a1c413b5
commit 7801b12402
2 changed files with 59 additions and 58 deletions
+56 -55
View File
@@ -8,8 +8,30 @@ on:
jobs:
build-and-test:
name: Build and Test
name: Build and Test - BCM${{ matrix.bcm }}
runs-on: ubuntu-latest
strategy:
matrix:
bcm: [2835, 2836, 2837]
include:
- bcm: 2835
kernel_name: kernel.img
pi_model: "Pi Zero/1"
qemu_machine: raspi0
qemu_mem: 512
qemu_binary: qemu-system-arm
- bcm: 2836
kernel_name: kernel7.img
pi_model: "Pi 2"
qemu_machine: raspi2b
qemu_mem: 1024
qemu_binary: qemu-system-arm
- bcm: 2837
kernel_name: kernel8.img
pi_model: "Pi 3"
qemu_machine: raspi3b
qemu_mem: 1024
qemu_binary: qemu-system-aarch64
steps:
- name: Checkout code
@@ -28,71 +50,26 @@ jobs:
qemu-system-arm --version
qemu-system-aarch64 --version
- name: Build BCM2835 (RPi Zero/1)
- name: Build BCM${{ matrix.bcm }} (${{ matrix.pi_model }})
run: |
cd build
export BCM=2835
export BCM=${{ matrix.bcm }}
make clean
make
ls -lh kernel.img
ls -lh ${{ matrix.kernel_name }}
- name: Build BCM2836 (RPi 2)
- name: Test BCM${{ matrix.bcm }} in QEMU
run: |
cd build
export BCM=2836
make clean
make
ls -lh kernel7.img
- name: Build BCM2837 (RPi 3) - 64-bit
run: |
cd build
export BCM=2837
make clean
make
ls -lh kernel8.img
- name: Test BCM2835 in QEMU
run: |
cd build
export BCM=2835
export BCM=${{ matrix.bcm }}
# Run QEMU for 3 seconds to verify it loads and executes
timeout 3 make run || true
echo "✓ BCM2835 kernel runs in QEMU without crashing"
- name: Test BCM2836 in QEMU
run: |
cd build
export BCM=2836
# Run QEMU for 3 seconds to verify it loads and executes
timeout 3 make run || true
echo "✓ BCM2836 kernel runs in QEMU without crashing"
- name: Test BCM2837 in QEMU
run: |
cd build
export BCM=2837
# Run QEMU for 3 seconds to verify it loads and executes
timeout 3 make run || true
echo "✓ BCM2837 kernel runs in QEMU without crashing"
- name: Run unit tests
run: |
cd tests
python3 test_memory.py
- name: Run integration tests
run: |
cd tests
bash run_tests.sh
echo "✓ BCM${{ matrix.bcm }} kernel runs in QEMU without crashing"
- name: Check binary size
run: |
cd build
export BCM=2836
make clean
make
SIZE=$(stat -c%s kernel7.img)
SIZE=$(stat -c%s ${{ matrix.kernel_name }})
echo "Binary size: $SIZE bytes"
if [ $SIZE -gt 100000 ]; then
echo "Warning: Binary size exceeds 100KB (size: $SIZE bytes)"
@@ -103,10 +80,34 @@ jobs:
- name: Archive build artifacts
uses: actions/upload-artifact@v4
with:
name: kernel-images
path: build/kernel*.img
name: kernel-bcm${{ matrix.bcm }}-${{ matrix.kernel_name }}
path: build/${{ matrix.kernel_name }}
retention-days: 30
run-integration-tests:
name: Run Integration Tests
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install ARM toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-none-eabi binutils-arm-none-eabi gcc-aarch64-linux-gnu
- name: Run unit tests
run: |
cd tests
python3 test_memory.py
- name: Run integration tests
run: |
cd tests
bash run_tests.sh
static-analysis:
# Disable this job for now
if: false
+3 -3
View File
@@ -51,11 +51,11 @@ echo "Testing build for BCM2835 (Raspberry Pi Zero/1)..."
cd ../build
export BCM=2835
if make clean > /dev/null 2>&1 && make > /dev/null 2>&1; then
if [ -f kernel7.img ]; then
SIZE=$(stat -c%s kernel7.img 2>/dev/null || stat -f%z kernel7.img 2>/dev/null)
if [ -f kernel.img ]; then
SIZE=$(stat -c%s kernel.img 2>/dev/null || stat -f%z kernel.img 2>/dev/null)
print_result 0 "BCM2835 build successful (size: $SIZE bytes)"
else
print_result 1 "BCM2835 build failed - kernel7.img not found"
print_result 1 "BCM2835 build failed - kernel.img not found"
fi
else
print_result 1 "BCM2835 build failed"