regolith 0.1.0

ACID, performance oriented, embedded key-value database engine for edge systems
Documentation
name: Embedded

# Split into its own workflow so it carries its own status badge. A
# badge is per workflow, not per job, so a suite whose result the README
# advertises has to be a workflow of its own.

on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always
  # The profile written for CI: a slower, noisier host gets a looser
  # slow-timeout than a workstation, and one retry so a genuinely flaky
  # test is reported as flaky rather than as a failure. See
  # `.config/nextest.toml`.
  NEXTEST_PROFILE: ci
  RUSTFLAGS: -D warnings

# Every `run` step goes through `bash -eo pipefail` rather than
# GitHub's default `bash -e`. Without `pipefail` a step like
# `just cov-summary | tee summary.txt` reports `tee`'s exit status,
# so a recipe that died with "command not found" still concluded
# green and published an empty report.
defaults:
  run:
    shell: bash

jobs:

  # Tier A embedded: Linux-class targets with std (Cortex-A boards,
  # ESP32-S3 under esp-idf). These compile today, and nothing stopped
  # them regressing - a new `cfg(unix)` dependency or a
  # `target_os = "linux"` assumption would break them silently between
  # releases. Checking the examples too keeps the embedded measuring
  # harness itself cross-compilable.
  embedded-tier-a:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        target:
          - aarch64-unknown-linux-gnu
          - armv7-unknown-linux-gnueabihf
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - uses: Swatinem/rust-cache@v2
      - name: Check the library and tools
        run: cargo check --workspace --target ${{ matrix.target }}
      - name: Check the examples
        run: cargo check --examples --target ${{ matrix.target }}

  # The embedded budget is a measured claim, so it is re-measured on
  # every run rather than quoted from a README. Both figures land in
  # the job summary: memory high-water through a full lifecycle, and
  # worst-case stack depth per code path.


  # The embedded budget is a measured claim, so it is re-measured on
  # every run rather than quoted from a README. Both figures land in
  # the job summary: memory high-water through a full lifecycle, and
  # worst-case stack depth per code path.
  embedded-budget:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - uses: extractions/setup-just@v2
      - name: Add the wasm target
        run: rustup target add wasm32-wasip1
      - uses: bytecodealliance/actions/wasmtime/setup@v1
      - name: Memory high-water, every profile on both hosts
        run: |
          set -euo pipefail
          just wasm-budget 20000 | tee profile-memory.txt
      - name: Worst-case stack depth per path
        run: |
          set -euo pipefail
          cargo run --release --example stack_depth -- \
            "$RUNNER_TEMP/regolith-stack" | tee stack-depth.txt
      - name: Publish the embedded budget
        run: |
          {
            echo "## Embedded budget"
            echo ""
            echo "### Memory high-water: embedded, wasm and default, on x86_64 and wasm32-wasip1"
            echo '```'
            cat profile-memory.txt
            echo '```'
            echo "### Stack depth"
            echo '```'
            cat stack-depth.txt
            echo '```'
          } >> "$GITHUB_STEP_SUMMARY"

  # Loom model checking. Exhaustive over the C11 interleavings the
  # memtable's publication protocol and the read horizon permit, which
  # no amount of stress testing covers. Both profiles run: the skip
  # list's single-writer guard is a `debug_assert`, so its calibration
  # only exists in a debug build.