Skip to content

fix(ci): install gcc-multilib for native_sim 32-bit host build #17

fix(ci): install gcc-multilib for native_sim 32-bit host build

fix(ci): install gcc-multilib for native_sim 32-bit host build #17

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
python:
name: Python Tests & Lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Lint with ruff
run: ruff check python/
- name: Type check with mypy
run: mypy python/arbiter/
- name: Run tests
run: pytest tests/python -v
- name: Validate sample model
run: arbiterc validate samples/battery_policy/models/battery.arb.yaml --strict
spdx:
name: SPDX Header Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check SPDX headers
run: |
missing=0
for f in $(find lib/ include/ subsys/ python/ -name '*.c' -o -name '*.h' -o -name '*.py' | grep -v __pycache__); do
if ! head -5 "$f" | grep -q 'SPDX-License-Identifier'; then
echo "Missing SPDX header: $f"
missing=1
fi
done
exit $missing
zephyr:
name: Zephyr Twister Tests
runs-on: ubuntu-latest
env:
# native_sim uses host GCC; skip cross-compiler toolchain lookup.
ZEPHYR_TOOLCHAIN_VARIANT: host
steps:
- uses: actions/checkout@v4
with:
# west.yml declares self.path: app — match it so west module
# resolution works correctly alongside modules/lib/arbiter/
path: app
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install west
run: pip install west
# Cache the Zephyr tree and west state keyed on west.yml.
# All three paths are saved/restored together so a partial
# hit cannot leave the workspace in an inconsistent state.
- name: Cache west workspace
id: cache-west
uses: actions/cache@v4
with:
path: |
zephyr
modules
.west
key: west-${{ hashFiles('app/west.yml') }}
restore-keys: west-
# Only run init+update on a cache miss; .west/config is
# restored from cache and is sufficient for subsequent steps.
- name: West init
if: steps.cache-west.outputs.cache-hit != 'true'
run: west init -l app
# --narrow: only fetch projects in our top-level manifest
# (zephyr + arbiter), skipping Zephyr's full HAL set.
# -o=--depth=1: shallow clone to keep the runner fast.
# native_sim needs only the Zephyr core tree, no HALs.
- name: West update
if: steps.cache-west.outputs.cache-hit != 'true'
run: west update --narrow -o=--depth=1
# west treats the manifest project as already-present at app/ and will
# NOT clone it to modules/lib/arbiter/ (its declared path). Copy it
# there so Zephyr CMake can discover the module's Kconfig + cmake files.
# Runs unconditionally (idempotent) so a restored cache that predates
# this step still gets the directory populated correctly.
- name: Place arbiter at canonical module path
run: |
mkdir -p modules/lib
if [ ! -d modules/lib/arbiter ]; then
cp -rp app modules/lib/arbiter
fi
# native_sim/native targets 32-bit by default; gcc-multilib provides
# the 32-bit glibc headers (bits/libc-header-start.h) on ubuntu-latest.
- name: Install native_sim build dependencies
run: sudo apt-get install -y --no-install-recommends gcc-multilib g++-multilib
- name: Install Zephyr Python requirements
run: pip install -r zephyr/scripts/requirements.txt
# Zephyr CMake requires find_package(Zephyr-sdk) even for native_sim
# (host tools: DTC, cmake config files). The minimal bundle is ~10 MB
# and contains no cross-compiler — only the cmake registration files.
# setup.sh -c writes ~/.cmake/packages/Zephyr-sdk/ so CMake finds it.
# SDK 0.17.0 matches pinned Zephyr v4.4.0 (update this if west.yml
# revision ever changes). sdk-version file does not exist in v4.4.0.
- name: Install Zephyr SDK (minimal, cmake files only)
env:
SDK_VER: "0.17.0"
run: |
wget -q \
"https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${SDK_VER}/zephyr-sdk-${SDK_VER}_linux-x86_64_minimal.tar.xz" \
-O /tmp/zephyr-sdk-minimal.tar.xz
mkdir -p ~/zephyr-sdk
tar -xf /tmp/zephyr-sdk-minimal.tar.xz --strip-components=1 -C ~/zephyr-sdk
~/zephyr-sdk/setup.sh -c
- name: Debug — module discovery
run: |
echo "=== west list ==="
west list
echo "=== modules/ ==="
ls -la modules/ 2>/dev/null || echo "(no modules/ dir)"
echo "=== modules/lib/ ==="
ls -la modules/lib/ 2>/dev/null || echo "(no modules/lib/)"
echo "=== modules/lib/arbiter/ ==="
ls modules/lib/arbiter/ 2>/dev/null || echo "(no arbiter module)"
echo "=== zephyr/module.yml in arbiter? ==="
cat modules/lib/arbiter/zephyr/module.yml 2>/dev/null || echo "(not found)"
# Unit tests run as native executables on native_sim.
- name: Twister — unit tests
run: |
west twister \
-T app/tests/unit \
-p native_sim \
--inline-logs -v \
-O twister-out/unit
# Benchmarks execute on native_sim; Twister captures timing output
# as an artifact. pass/fail is gated on the final log line regex.
- name: Twister — benchmarks
run: |
west twister \
-T app/tests/benchmarks \
-p native_sim \
--inline-logs -v \
-O twister-out/benchmarks
# All 17 samples are build_only; CI proves they compile clean.
- name: Twister — samples
run: |
west twister \
-T app/samples \
-p native_sim \
--inline-logs -v \
-O twister-out/samples
- name: Upload Twister results
if: always()
uses: actions/upload-artifact@v4
with:
name: twister-results
path: twister-out/