Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 49 additions & 112 deletions .github/workflows/eosim-sanity.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
name: EoSim Sanity

on:
# A change to this file tests itself. Without this the workflow was
# schedule- and dispatch-only, so a pull request editing it produced no
# run of it at all.
# A change to this file, or to the commands it exercises, tests itself.
pull_request:
paths:
- '.github/workflows/eosim-sanity.yml'
- 'ebuild/cli/golden_path.py'
- 'ebuild/templates/**'
schedule:
- cron: '0 4 * * *'
workflow_dispatch:

env:
# v0.1.0 has never existed. embeddedos-org/EoSim tags v1.0.0 through
# v3.0.1, so `git clone --branch v0.1.0` fails with "Remote branch
# v0.1.0 not found in upstream origin" and this workflow has never had a
# green run. v1.5.0 is the release marked Latest and installs from source.
EOSIM_VERSION: "1.5.0"
# A pinned EoSim commit, not a tag. Every tag through v3.0.1 has the
# filter bug in which "eosim list" printed "Available platforms (0)" and
# still exited 0 (EoSim#34). This workflow checked only exit codes, so it
# stayed green while listing nothing. c5e2770 is the merge of EoSim#35,
# which fixes that. Move this to a release tag once one contains it.
EOSIM_REF: "c5e27702b9ab8e3e9dcf34b7686a1c1c1040515c"

permissions:
contents: read
Expand All @@ -39,132 +40,68 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install EoSim from source
- name: Install EoSim and this ebuild
run: |
git clone --depth 1 --branch v${{ env.EOSIM_VERSION }} https://github.com/embeddedos-org/EoSim.git /tmp/EoSim
pip install -e /tmp/EoSim
- name: Verify installation
python -m pip install "embeddedos-eosim @ git+https://github.com/embeddedos-org/EoSim@${{ env.EOSIM_REF }}" .
- name: The registry is not empty
# Exit status alone proved nothing here: "eosim list" exited 0 while
# listing zero platforms. Count what it returns.
shell: python
run: |
eosim --version
eosim list
- name: Validate all platform configs
run: eosim list && eosim doctor
import json, subprocess
rows = json.loads(subprocess.check_output(["eosim", "list", "--format", "json"], text=True))
names = subprocess.check_output(["ebuild", "platforms", "list", "--format", "names"], text=True).split()
print(f"eosim list: {len(rows)} platforms; ebuild platforms list: {len(names)}")
assert len(rows) >= 100, f"eosim list returned only {len(rows)} platforms"
assert sorted(names) == sorted(r["name"] for r in rows), "ebuild and eosim disagree"
- name: eosim doctor
run: eosim doctor

nested-simulation:
name: Nested Simulation (${{ matrix.platform }})
needs: install-validate
# The getting-started guide's simulator path, run as written: setup, init,
# then sim. ebuild sim builds the rtos template with the EoS kernel for
# QEMU's Cortex-M3 machine and passes only if the expected output shows up.
golden-path:
name: Getting-started path (ebuild init + ebuild sim on QEMU)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- x86_64-linux
- arm64-linux
- riscv64-linux
- stm32f4
- raspi4
- esp32
- nrf52
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install EoSim from source
- name: Install toolchain and QEMU
run: |
git clone --depth 1 --branch v${{ env.EOSIM_VERSION }} https://github.com/embeddedos-org/EoSim.git /tmp/EoSim
pip install -e /tmp/EoSim
- name: Simulate ${{ matrix.platform }}
sudo apt-get update -qq
sudo apt-get install -y gcc-arm-none-eabi libnewlib-arm-none-eabi qemu-system-arm
- name: Install ebuild and EoSim
run: python -m pip install "embeddedos-eosim @ git+https://github.com/embeddedos-org/EoSim@${{ env.EOSIM_REF }}" .
- name: ebuild setup
run: ebuild setup
- name: ebuild init
working-directory: ${{ runner.temp }}
run: ebuild init my-blink --template rtos --target stm32f4
- name: ebuild sim boots the EoS kernel and the app runs
working-directory: ${{ runner.temp }}/my-blink
run: ebuild sim --expect 'id=3 value=40' --timeout 60
- name: Unsupported boards are refused, not faked
working-directory: ${{ runner.temp }}/my-blink
run: |
eosim run ${{ matrix.platform }} --headless --timeout 10
echo "${{ matrix.platform }}: PASSED"

nested-guest-install:
name: Guest OS Install (${{ matrix.guest }})
needs: install-validate
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- guest: Linux x86_64
platform: x86_64-linux
- guest: Linux aarch64
platform: arm64-linux
- guest: Linux riscv64
platform: riscv64-linux
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install EoSim from source
run: |
git clone --depth 1 --branch v${{ env.EOSIM_VERSION }} https://github.com/embeddedos-org/EoSim.git /tmp/EoSim
pip install -e /tmp/EoSim
- name: Boot guest and test EoSim inside
run: |
echo "=== Nested Guest: ${{ matrix.guest }} ==="
eosim run ${{ matrix.platform }} --headless --timeout 15
echo "${{ matrix.guest }}: PASSED"

windows-sanity:
name: Windows Sanity
needs: install-validate
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install EoSim from source
run: |
git clone --depth 1 --branch v${{ env.EOSIM_VERSION }} https://github.com/embeddedos-org/EoSim.git /tmp/EoSim
pip install -e /tmp/EoSim
- name: Test EoSim on Windows
run: |
eosim --version
eosim list && eosim doctor
eosim list

macos-sanity:
name: macOS Sanity
needs: install-validate
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install EoSim from source
run: |
git clone --depth 1 --branch v${{ env.EOSIM_VERSION }} https://github.com/embeddedos-org/EoSim.git /tmp/EoSim
pip install -e /tmp/EoSim
- name: Test EoSim on macOS
run: |
eosim --version
eosim list && eosim doctor
eosim list
if ebuild sim --platform esp32; then
echo "::error::ebuild sim --platform esp32 reported success; there is no ESP32 sim target"
exit 1
fi

sanity-gate:
name: EoSim Sanity Gate
if: always()
needs: [install-validate, nested-simulation, nested-guest-install, windows-sanity, macos-sanity]
needs: [install-validate, golden-path]
runs-on: ubuntu-latest
steps:
# Iterates toJSON(needs) rather than naming one dependency. The previous
# body tested install-validate alone and then printed "All EoSim sanity
# checks passed" -- which it did on 2026-09-17 (run 35181688794) with
# Windows Sanity and macOS Sanity both red. Five jobs in needs:, one
# checked. This form cannot fall out of step with needs:, and it is the
# gate eos and eBoot already run.
# Iterates toJSON(needs) so the gate cannot fall out of step with needs:.
- name: Every job in this workflow must have succeeded
env:
RESULTS: ${{ toJSON(needs) }}
run: |
set -euo pipefail
# Refuse to conclude anything from nothing: an empty or null
# RESULTS is not "no failures".
if [ -z "${RESULTS:-}" ] || [ "$RESULTS" = "null" ]; then
echo "::error::gate received no results to check"
exit 1
Expand Down
3 changes: 2 additions & 1 deletion ebuild/cli/golden_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ def platforms_list(fmt: str) -> None:
from eosim.cli.main import _load_registry
except ImportError as exc: # pragma: no cover - exercised without eosim
raise SimError("EoSim is not installed: pip install "
"'eosim @ git+https://github.com/embeddedos-org/EoSim'") from exc
"'embeddedos-eosim @ git+https://github.com/embeddedos-org/EoSim'"
) from exc
entries = sorted(_load_registry().all(), key=lambda p: p.name)
if not entries:
raise SimError("EoSim's platform registry is empty")
Expand Down
Loading