repositories / smith
smith
There are many coding harnesses - but this one is fast
owned by bugabinga
.github/workflows/prototypes.yml
Raw# Standing guard for the prototype evidence base. Prototypes are kept as
# evidence for docs/SPEC.md (prototypes/CLAUDE.md, §18): locked deps and verify
# commands that must keep exiting 0. This builds+tests every prototype crate on
# a clean runner and FAILS if any regresses — a bit-rot guard against yanked
# deps, pre-1.0 churn (jj-lib, kstring), and stable-compiler bumps.
#
# The p34-ci-pipeline dir is excluded: it is not a normal single-crate
# prototype (it holds cross/ and archgate/ sub-crates) and is exercised by
# ci-prototype.yml instead.
name: prototypes
# The branch filter used to name a single feature branch, which has since
# merged — so this guard ran nowhere. A bit-rot guard that only fires on a dead
# branch protects nothing, and the prototypes it watches are the evidence base
# for SPEC claims. It now runs where the evidence can actually change: pull
# requests that touch a prototype, and `main` after they land.
on:
push:
branches: ["main"]
paths: &proto
- "prototypes/**"
- "!prototypes/**/*.md"
- "!prototypes/p34-ci-pipeline/**"
- ".github/workflows/prototypes.yml"
# The root manifest decides whether a prototype can build at all: a
# package inside the workspace directory that is neither a member nor
# excluded is one Cargo refuses outright. That is precisely how all 28
# broke when the workspace landed, and a filter watching only
# `prototypes/**` would not have fired on the commit that did it.
- "Cargo.toml"
- "rust-toolchain.toml"
pull_request:
branches: ["main"]
paths: *proto
workflow_dispatch: {}
permissions:
contents: read
concurrency:
group: prototypes-${{ github.ref }}
cancel-in-progress: true
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: toolchain
run: rustup default stable && rustc -V && cargo -V
- name: build + test every prototype (fail if any regresses)
run: |
# Each cargo compile runs with CWD inside the prototype tree so the
# cap-lints=warn exemption (prototypes/.cargo/config.toml) applies;
# building via --manifest-path from the root inherits -D warnings.
echo "## Prototype build+test" >> "$GITHUB_STEP_SUMMARY"
echo "| crate | result | seconds |" >> "$GITHUB_STEP_SUMMARY"
echo "|-------|--------|---------|" >> "$GITHUB_STEP_SUMMARY"
failed=""
total=0
# Every prototype directory, not just `p*`: adw-pioneer names its
# output after the issue (`i<issue>-<slug>`) because two runs cannot
# see each other's unmerged branches to agree a sequential number. A
# glob that silently skips a whole naming scheme is worse than a
# failing test — the prototype looks covered and is never run. The
# Cargo.toml guard below is what actually decides; the glob only has
# to avoid excluding candidates.
for d in prototypes/*/; do
[ -f "$d/Cargo.toml" ] || continue
case "$d" in prototypes/p34-ci-pipeline/) continue;; esac
name=$(basename "$d")
start=$SECONDS
if ( cd "$d" && cargo test --quiet ) >/tmp/proto.log 2>&1; then
status="ok"
else
status="FAIL"
failed="$failed $name"
echo "::group::$name FAILED"; cat /tmp/proto.log; echo "::endgroup::"
fi
dur=$((SECONDS - start))
total=$((total + dur))
echo "| $name | $status | $dur |" >> "$GITHUB_STEP_SUMMARY"
done
echo "| **total** | | **$total** |" >> "$GITHUB_STEP_SUMMARY"
if [ -n "$failed" ]; then
echo "prototype regressions:$failed"
exit 1
fi
echo "all prototypes green"