#!/bin/bash # The port's gate: every chip's generated workflow - build, size matrix, and # the simulator-driven protocol suites. --full adds the reflect-spot builds # (libavr's rule: reflect compiles are bounded to its spot set, never the # full matrix) and swaps the compact size matrix for the exhaustive # clock x baud x backend cross product. libavr resolves from the `libavr/` # submodule; LIBAVR_ROOT overrides it for a working tree. set -e cd "$(dirname "$0")/.." full=0 [[ "$1" == "--full" ]] && { full=1; shift; export PUREBOOT_FULL_MATRIX=1; } # The chip lists come from the presets rather than being spelled a second time # here: a chip added to make_presets.py and missed in a copy of its list would # be a gate that silently never builds it, which is the one failure mode a gate # cannot report. tools/make_presets.py is the single source, CMakePresets.json # is its output, and this reads that. readarray -t WORKFLOWS < <(python3 -c ' import json, sys presets = json.load(open("CMakePresets.json"))["workflowPresets"] print("\n".join(p["name"] for p in presets))') if ((${#WORKFLOWS[@]} == 0)); then echo "no workflow presets in CMakePresets.json - run tools/make_presets.py" >&2 exit 1 fi CHIPS=() REFLECT_SPOT=() for workflow in "${WORKFLOWS[@]}"; do case $workflow in *-generated) CHIPS+=("${workflow%-generated}") ;; *-reflect) REFLECT_SPOT+=("${workflow%-reflect}") ;; esac done # Every preset runs even after one goes red, and the gate fails at the end # naming all of them: stopping at the first failure turns a red - a stale size # canary above all - into an alibi for every chip behind it, and a loader can # ship on a chip this gate has not compiled since. red=() run_preset() { echo "==== $1 ====" cmake --workflow --preset "$1" "${@:2}" || red+=("$1") } for chip in "${CHIPS[@]}"; do run_preset "$chip-generated" "$@" done if ((full)); then for chip in "${REFLECT_SPOT[@]}"; do run_preset "$chip-reflect" "$@" done fi if ((${#red[@]})); then printf '==== red presets ====\n' >&2 printf ' %s\n' "${red[@]}" >&2 exit 1 fi # Every tree is freshly built now - the one moment the README's size table # can be held to what the images measure (a per-preset ctest sees only its # own chip; the table needs all of them, and ungated it drifts: a # common-code shave moves every row at once with nothing over budget). python3 tools/sizes.py check-readme echo "check: every chip green"