Skip to content

ebuild v0.1.0 — EoS Build System & SDK Generator #41

ebuild v0.1.0 — EoS Build System & SDK Generator

ebuild v0.1.0 — EoS Build System & SDK Generator #41

# ═══════════════════════════════════════════════════════════════
# EoS Unified Integration Build + QEMU Test Pipeline
#
# Checks out ALL 6 repos, builds natively + cross-compiles,
# runs EIPC Go integration tests, and validates on QEMU.
#
# Architecture matrix:
# - x86_64 (native) — host build + unit tests
# - aarch64 (QEMU) — cross-compile → qemu-system-aarch64
# - arm (QEMU) — cross-compile → qemu-arm (Cortex-M/A)
# - riscv64 (QEMU) — cross-compile → qemu-system-riscv64
#
# Repo layout after checkout:
# workspace/
# ├── ebuild/ ← build orchestrator (Python)
# ├── eos/ ← embedded OS (C)
# ├── eboot/ ← bootloader (C)
# ├── eni/ ← neural interface adapter (C)
# ├── eai/ ← AI layer (C)
# └── eipc/ ← embedded IPC (Go + C SDK)
# ═══════════════════════════════════════════════════════════════
name: Integration + QEMU
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
inputs:
qemu_timeout:
description: "QEMU test timeout (seconds)"
default: "120"
skip_cross:
description: "Skip cross-compilation jobs"
type: boolean
default: false
permissions:
contents: read
env:
QEMU_TIMEOUT: ${{ github.event.inputs.qemu_timeout || '120' }}
jobs:
# ──────────────────────────────────────────────────────────────
# Stage 1: Checkout all repos
# ──────────────────────────────────────────────────────────────
checkout-all:
name: Checkout All Repos
runs-on: ubuntu-latest
steps:
- name: Checkout ebuild
uses: actions/checkout@v4
with:
path: ebuild
- name: Checkout eos
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/eos
path: eos
- name: Checkout eboot
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/eboot
path: eboot
- name: Checkout eni
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/eni
path: eni
- name: Checkout eai
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/eai
path: eai
- name: Checkout eipc
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/eipc
path: eipc
- name: Verify repo layout
run: |
echo "═══ EoS Workspace ═══"
for repo in ebuild eos eboot eni eai eipc; do
if [ -d "$repo" ]; then
echo " ✅ $repo/"
else
echo " ❌ $repo/ — MISSING"
exit 1
fi
done
- name: Upload workspace
uses: actions/upload-artifact@v4
with:
name: eos-workspace
path: .
retention-days: 1
# ──────────────────────────────────────────────────────────────
# Stage 2a: Native x86_64 build + unit tests (all C projects)
# ──────────────────────────────────────────────────────────────
native-build:
name: Native Build + Test (x86_64)
needs: checkout-all
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: eos-workspace
- name: Install build tools
run: |
sudo apt-get update -qq
sudo apt-get install -y cmake ninja-build gcc g++
- name: Build eos (native)
run: |
cmake -B eos/build -S eos -G Ninja -DEOS_BUILD_TESTS=ON
cmake --build eos/build
echo "✅ eos built"
- name: Test eos
run: ctest --test-dir eos/build --output-on-failure
- name: Build eboot (native)
run: |
cmake -B eboot/build -S eboot -G Ninja -DEBLDR_BUILD_TESTS=ON
cmake --build eboot/build
echo "✅ eboot built"
- name: Test eboot
run: ctest --test-dir eboot/build --output-on-failure
- name: Build eni (native)
run: |
cmake -B eni/build -S eni -G Ninja -DENI_BUILD_TESTS=ON
cmake --build eni/build
echo "✅ eni built"
- name: Test eni
run: ctest --test-dir eni/build --output-on-failure
- name: Build eai (native)
run: |
cmake -B eai/build -S eai -G Ninja -DEAI_BUILD_TESTS=ON
cmake --build eai/build
echo "✅ eai built"
- name: Test eai
run: ctest --test-dir eai/build --output-on-failure
- name: Build EIPC C SDK (native)
run: |
cmake -B eipc/sdk/c/build -S eipc/sdk/c -G Ninja
cmake --build eipc/sdk/c/build
echo "✅ eipc C SDK built"
- name: Test EIPC C SDK
run: ctest --test-dir eipc/sdk/c/build --output-on-failure
continue-on-error: true
# ──────────────────────────────────────────────────────────────
# Stage 2b: EIPC Go build + integration tests
# ──────────────────────────────────────────────────────────────
go-integration:
name: Go Integration Tests (EIPC)
needs: checkout-all
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: eos-workspace
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Build EIPC
working-directory: eipc
run: go build ./...
- name: Vet
working-directory: eipc
run: go vet ./...
- name: Run all Go tests (including integration)
working-directory: eipc
run: |
go test -race -v -count=1 ./... 2>&1 | tee test-results.txt
echo "✅ EIPC Go tests passed"
- name: Upload Go test results
if: always()
uses: actions/upload-artifact@v4
with:
name: go-test-results
path: eipc/test-results.txt
# ──────────────────────────────────────────────────────────────
# Stage 2c: ebuild Python tests + EoS AI pipeline
# ──────────────────────────────────────────────────────────────
ebuild-tests:
name: ebuild Tests + EoS AI Pipeline
needs: checkout-all
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: eos-workspace
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install ebuild
run: |
cd ebuild
pip install -e .
pip install pytest pyyaml click
- name: Run ebuild unit tests
working-directory: ebuild
run: python -m pytest tests/test_eos_ai.py -v --tb=short
- name: Run full pipeline test
working-directory: ebuild
run: python test_full_pipeline.py
- name: Verify generated files
working-directory: ebuild
run: |
test -f _generated_test/board.yaml
test -f _generated_test/boot.yaml
test -f _generated_test/eos_product_config.h
test -f _generated_test/eboot_flash_layout.h
echo "✅ EoS AI pipeline generated all expected files"
# ──────────────────────────────────────────────────────────────
# Stage 3: Cross-compile for target architectures
# ──────────────────────────────────────────────────────────────
cross-compile:
name: Cross (${{ matrix.arch }})
needs: checkout-all
if: ${{ github.event.inputs.skip_cross != 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch: aarch64
triplet: aarch64-linux-gnu
toolchain_eos: toolchains/aarch64-linux-gnu.cmake
toolchain_eboot: toolchains/aarch64-linux-gnu.cmake
packages: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
qemu_bin: qemu-system-aarch64
qemu_machine: virt
qemu_cpu: cortex-a57
- arch: arm-cortex-m
triplet: arm-none-eabi
toolchain_eos: ""
toolchain_eboot: toolchains/arm-none-eabi.cmake
packages: gcc-arm-none-eabi libnewlib-arm-none-eabi
qemu_bin: qemu-system-arm
qemu_machine: lm3s6965evb
qemu_cpu: cortex-m3
- arch: riscv64
triplet: riscv64-linux-gnu
toolchain_eos: toolchains/riscv64-linux-gnu.cmake
toolchain_eboot: toolchains/riscv64-linux-gnu.cmake
packages: gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
qemu_bin: qemu-system-riscv64
qemu_machine: virt
qemu_cpu: rv64
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: eos-workspace
- name: Install cross-compiler + QEMU
run: |
sudo apt-get update -qq
sudo apt-get install -y cmake ninja-build ${{ matrix.packages }} \
qemu-system-arm qemu-system-misc qemu-user
- name: Cross-compile eboot (${{ matrix.arch }})
if: matrix.toolchain_eboot != ''
run: |
cmake -B eboot/build-${{ matrix.arch }} -S eboot -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain_eboot }} \
-DEBLDR_BUILD_TESTS=OFF
cmake --build eboot/build-${{ matrix.arch }}
echo "✅ eboot cross-compiled for ${{ matrix.arch }}"
- name: Cross-compile eos (${{ matrix.arch }})
if: matrix.toolchain_eos != ''
run: |
cmake -B eos/build-${{ matrix.arch }} -S eos -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain_eos }} \
-DEOS_BUILD_TESTS=OFF
cmake --build eos/build-${{ matrix.arch }}
echo "✅ eos cross-compiled for ${{ matrix.arch }}"
- name: Cross-compile eni (${{ matrix.arch }})
if: matrix.toolchain_eos != ''
run: |
cmake -B eni/build-${{ matrix.arch }} -S eni -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain_eos }} \
-DENI_BUILD_TESTS=OFF
cmake --build eni/build-${{ matrix.arch }}
echo "✅ eni cross-compiled for ${{ matrix.arch }}"
- name: Cross-compile eai (${{ matrix.arch }})
if: matrix.toolchain_eos != ''
run: |
cmake -B eai/build-${{ matrix.arch }} -S eai -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain_eos }} \
-DEAI_BUILD_TESTS=OFF
cmake --build eai/build-${{ matrix.arch }}
echo "✅ eai cross-compiled for ${{ matrix.arch }}"
- name: Cross-compile EIPC C SDK (${{ matrix.arch }})
if: matrix.toolchain_eos != ''
run: |
cmake -B eipc/sdk/c/build-${{ matrix.arch }} -S eipc/sdk/c -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=../../eos/${{ matrix.toolchain_eos }}
cmake --build eipc/sdk/c/build-${{ matrix.arch }}
echo "✅ eipc C SDK cross-compiled for ${{ matrix.arch }}"
continue-on-error: true
- name: Verify cross-compiled artifacts
run: |
echo "═══ Cross-compiled artifacts (${{ matrix.arch }}) ═══"
find . -name "*.a" -path "*build-${{ matrix.arch }}*" | head -20
find . -name "*.bin" -path "*build-${{ matrix.arch }}*" | head -20
find . -name "*.elf" -path "*build-${{ matrix.arch }}*" | head -20
- name: Upload cross-compiled artifacts
uses: actions/upload-artifact@v4
with:
name: cross-${{ matrix.arch }}
path: |
**/build-${{ matrix.arch }}/**/*.a
**/build-${{ matrix.arch }}/**/*.bin
**/build-${{ matrix.arch }}/**/*.elf
retention-days: 3
# ──────────────────────────────────────────────────────────────
# Stage 4: QEMU smoke tests
# ──────────────────────────────────────────────────────────────
qemu-test:
name: QEMU (${{ matrix.arch }})
needs: cross-compile
if: ${{ github.event.inputs.skip_cross != 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch: aarch64
qemu_bin: qemu-system-aarch64
qemu_args: "-machine virt -cpu cortex-a57 -m 256 -nographic -no-reboot"
test_type: linux
- arch: riscv64
qemu_bin: qemu-system-riscv64
qemu_args: "-machine virt -m 256 -nographic -no-reboot -bios none"
test_type: linux
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: eos-workspace
- name: Download cross artifacts
uses: actions/download-artifact@v4
with:
name: cross-${{ matrix.arch }}
- name: Install QEMU
run: |
sudo apt-get update -qq
sudo apt-get install -y qemu-system-arm qemu-system-misc qemu-user
- name: QEMU version check
run: ${{ matrix.qemu_bin }} --version
- name: QEMU architecture validation
run: |
echo "═══ QEMU ${{ matrix.arch }} Architecture Validation ═══"
# Verify QEMU can enumerate the target machine
${{ matrix.qemu_bin }} -machine help 2>/dev/null | grep -i "virt" && \
echo "✅ Machine 'virt' available" || \
echo "⚠️ Machine 'virt' not found"
# Verify cross-compiled libraries exist
LIBS=$(find . -name "*.a" -path "*${{ matrix.arch }}*" 2>/dev/null | wc -l)
echo "Found $LIBS static libraries for ${{ matrix.arch }}"
if [ "$LIBS" -gt 0 ]; then
echo "✅ Cross-compiled artifacts present"
find . -name "*.a" -path "*${{ matrix.arch }}*" | head -10
else
echo "⚠️ No cross-compiled artifacts found"
fi
- name: QEMU boot test (kernel probe)
timeout-minutes: 3
run: |
echo "═══ QEMU Boot Probe (${{ matrix.arch }}) ═══"
# Create a minimal test: run QEMU with no kernel to verify
# the emulator starts, prints machine info, and exits.
timeout ${{ env.QEMU_TIMEOUT }} \
${{ matrix.qemu_bin }} ${{ matrix.qemu_args }} \
-kernel /dev/null \
-append "panic=1" \
2>&1 | head -50 || true
echo "✅ QEMU ${{ matrix.arch }} probe completed"
- name: QEMU user-mode binary test
if: matrix.arch == 'aarch64'
run: |
# If we have any user-mode executables, run them under qemu-user
BINS=$(find . -name "*.elf" -path "*aarch64*" -executable 2>/dev/null | head -5)
if [ -n "$BINS" ]; then
for bin in $BINS; do
echo "Testing: $bin"
timeout 10 qemu-aarch64 "$bin" 2>&1 || true
done
else
echo "No user-mode aarch64 executables to test"
fi
echo "✅ QEMU user-mode test completed"
# ──────────────────────────────────────────────────────────────
# Stage 5: Integration summary
# ──────────────────────────────────────────────────────────────
integration-gate:
name: Integration Gate
runs-on: ubuntu-latest
if: always()
needs: [native-build, go-integration, ebuild-tests, cross-compile, qemu-test]
steps:
- name: Evaluate results
env:
NATIVE: ${{ needs.native-build.result }}
GO: ${{ needs.go-integration.result }}
EBUILD: ${{ needs.ebuild-tests.result }}
CROSS: ${{ needs.cross-compile.result }}
QEMU: ${{ needs.qemu-test.result }}
run: |
echo "═══════════════════════════════════════════════"
echo " EoS Integration Build Results"
echo "═══════════════════════════════════════════════"
echo ""
echo " Native x86_64 build + tests : $NATIVE"
echo " EIPC Go integration tests : $GO"
echo " ebuild + EoS AI pipeline : $EBUILD"
echo " Cross-compile (3 archs) : $CROSS"
echo " QEMU smoke tests : $QEMU"
echo ""
FAILED=0
if [ "$NATIVE" != "success" ]; then
echo "::error::Native build failed"
FAILED=1
fi
if [ "$GO" != "success" ]; then
echo "::error::Go integration tests failed"
FAILED=1
fi
if [ "$EBUILD" != "success" ]; then
echo "::error::ebuild tests failed"
FAILED=1
fi
if [ "$CROSS" = "failure" ]; then
echo "::warning::Cross-compilation failed"
fi
if [ "$QEMU" = "failure" ]; then
echo "::warning::QEMU tests failed"
fi
if [ "$FAILED" -eq 1 ]; then
echo ""
echo "::error::Required checks failed — see above"
exit 1
fi
echo ""
echo "✅ All required checks passed"
echo "═══════════════════════════════════════════════"