memlnaut-nisps/scripts/run-all-tests.sh
monkey-w1n5t0n 8c249ea8af ci: restore verification — reachable submodule pin, codegen + WASM freshness gates
Phase 0 of the 2026-07 simplification audit (plan §1). CI has been 100% red on
main since 2026-07-13 and every "gates green" claim since rested on local runs.

- S7 / critic gap 2: push memllib `feat/nisps-core-swap` (3 commits incl. the
  pin b37fc53) to monkey-w1n5t0n/memllib and repoint .gitmodules at the fork.
  Those commits existed on exactly one disk; `git ls-remote` now resolves the
  pin, so `submodules: recursive` checkout and fresh clones work again. Drops
  the compensating unreachable-pin error paragraph in build-firmware-arch.sh.
- S24 / S31: the manifold-tests job regenerates from schemas/, runs the codegen
  golden test, and fails on a dirty diff — the "schema changes ship with both
  generated outputs" rule is now enforced rather than assumed.
- S32: a WASM freshness gate runs the parity harness against the *committed*
  manifold/public/nisps.{js,wasm} before the CI rebuild overwrites it. That
  artifact is what the webhook ships to production, so a stale commit now fails
  loudly instead of shipping.
- critic gap 3 / operator decision §7.4: the VPS webhook
  (~/.config/webhooks/meml-deploy.sh, not in this repo) waits for the `CI`
  workflow to conclude success on the pushed SHA before building. Fail-closed;
  MEML_SKIP_CI_GATE=1 for an emergency hand-deploy. Verified the gate query
  returns `failure` for fa37047, i.e. it would have blocked that deploy.
- S31: corrected run-all-tests.sh's false "single command CI invokes" header.

Docs moved with the code: ALIGNMENT defect 1 deleted (resolved) and the rest
renumbered; MAP.md's unreachable-pin warning replaced with the fork pin and a
pointer to the §7.5 vendoring decision; ONBOARDING documents the deploy gate
and the tracked-WASM-ships-to-prod hazard; plan §1 marked burned down.

Gates: scripts/run-all-tests.sh ALL GREEN (ctest 4/4, parity 1273 floats within
1e-5, lint, typecheck, 33 Playwright specs).
2026-07-21 11:57:32 +02:00

75 lines
2.7 KiB
Bash
Executable file

#!/usr/bin/env bash
# scripts/run-all-tests.sh — master local entrypoint that exercises every
# check the repo owns. CI (.github/workflows/ci.yml) does NOT invoke this
# script; it re-lists the same stages as discrete steps so failures are
# attributable per-step. Keep the two in sync when adding a stage.
#
# Stages (each fails fast):
# 1. C++ build + ctest → scripts/build-cpp-tests.sh
# 2. WASM build → scripts/build-wasm.sh
# 3. Parity check → scripts/parity-check.sh
# 4. Lint → scripts/lint-cpp.sh
# 5. Manifold tests → cd manifold && typecheck + build + bun test + playwright
#
# Flags via env:
# NISPS_SKIP_PLAYWRIGHT=1 skip the Playwright leg (useful in C++-only loops)
# NISPS_SKIP_WASM=1 skip WASM build + parity (no emcc available)
# NISPS_LINT_STRICT=1 treat lint warnings as failures
# PLAYWRIGHT_BROWSERS_PATH respected (on the VPS point it at the snap-bun
# browser cache — see docs/specs/plans/BUILD-PLAN.md)
#
# Exit codes: 0 on full success, otherwise the failing stage's exit code.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
stage() { printf '\n=== %s ===\n' "$1"; }
stage "1/5 C++ build + ctest"
"$ROOT/scripts/build-cpp-tests.sh"
if [[ "${NISPS_SKIP_WASM:-0}" != "1" ]]; then
stage "2/5 WASM build"
"$ROOT/scripts/build-wasm.sh"
stage "3/5 parity check"
"$ROOT/scripts/parity-check.sh"
else
stage "2/5 WASM build (skipped: NISPS_SKIP_WASM=1)"
stage "3/5 parity check (skipped: NISPS_SKIP_WASM=1)"
fi
stage "4/5 lint"
"$ROOT/scripts/lint-cpp.sh"
if [[ "${NISPS_SKIP_PLAYWRIGHT:-0}" != "1" ]]; then
stage "5/5 manifold tests"
if ! command -v bun >/dev/null 2>&1; then
echo "[run-all-tests] bun not on PATH; skipping manifold stage"
else
(
# Codegen idempotence golden (C++ + manifold TS outputs).
cd "$ROOT/codegen"
bun install --frozen-lockfile 2>/dev/null || bun install
bun run tests/golden_test.ts
)
(
cd "$ROOT/manifold"
bun install --frozen-lockfile 2>/dev/null || bun install
bun run typecheck
bun run test
bun run build
# The Playwright RUNNER goes through non-snap node: snap-confined
# bun cannot see host browser libraries (BUILD-PLAN gotcha).
# Ensure browsers are present. `--with-deps` is heavy; leave to CI.
node node_modules/.bin/playwright install chromium >/dev/null 2>&1 || true
node node_modules/.bin/playwright test
)
fi
else
stage "5/5 manifold tests (skipped: NISPS_SKIP_PLAYWRIGHT=1)"
fi
stage "ALL GREEN"