system-git-sync/cicd/run-review.sh
George Lambert 185cdaabdb
Some checks are pending
review / inventory (push) Waiting to run
S26: deploy generates nats.env PSK, FORBID_PLAIN, rebuilt pfc-repl
PDF bundle rsync so relative PDF links resolve on docs.pfc.
2026-09-15 23:29:25 -04:00

65 lines
2.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# Run tests for NATS/PFC/messaging repos. Exit non-zero on first failure.
# Does not deploy to ns1.
set -euo pipefail
ROOT="${RESEARCH:-$HOME/research}"
fail=0
run() {
echo "=== $* ==="
if ! "$@"; then
echo "FAIL: $*"
fail=1
fi
}
export PATH="/opt/homebrew/bin:$PATH"
run env PYTHONPATH="$ROOT/peergos-for-compliance/lib:$ROOT/peergos-for-compliance-admin:$ROOT/secure-messaging/python" \
python3 -m unittest discover -s "$ROOT/peergos-for-compliance/tests" -v
run env PYTHONPATH="$ROOT/secure-messaging/python" \
python3 -m unittest discover -s "$ROOT/secure-messaging/tests" -v
if [[ -d "$ROOT/secure-messaging/go" ]]; then
( cd "$ROOT/secure-messaging/go" && run go test ./... )
fi
if [[ -d "$ROOT/peergos-compliance-go" ]]; then
( cd "$ROOT/peergos-compliance-go" && run go test ./cmd/pfc-repl ./internal/leaf ./internal/envelope )
fi
if [[ -f "$ROOT/peergos-for-compliance-ipfs/pfc_ipfs/server.py" ]]; then
run python3 -m py_compile "$ROOT/peergos-for-compliance-ipfs/pfc_ipfs/server.py"
fi
if [[ -f "$ROOT/peergos-for-compliance-replication/pfc_repl/server.py" ]]; then
run python3 -m py_compile "$ROOT/peergos-for-compliance-replication/pfc_repl/server.py"
fi
if [[ -f "$ROOT/peergos-compliance-config/schema.json" ]]; then
run python3 -c "import json; json.load(open('$ROOT/peergos-compliance-config/schema.json'))"
fi
if [[ -f "$ROOT/nats-service-endpoints/catalog/endpoints.json" ]]; then
run python3 - << PY
import json
from pathlib import Path
root = Path("$ROOT")
core = json.loads((root/"nats-service-endpoints/catalog/endpoints.json").read_text())
derived = json.loads((root/"nats-service-endpoints/catalog/pfc-derived.json").read_text())
names = {e["name"] for e in core["endpoints"]} | {e["name"] for e in derived["endpoints"]}
need = {
"verae.sm.send",
"verae.sm.dead",
"verae.sm.error",
"verae.sm.log.summary",
"verae.admin.config.sign",
"verae.storage.pin",
"verae.storage.replicate",
"verae.pfc.health",
"verae.inspect.open",
}
missing = sorted(need - names)
assert not missing, missing
subj = {s["name"] for s in json.loads((root/"peergos-for-compliance/schemas/subjects.json").read_text())["subjects"]}
gap = sorted(subj - names)
assert not gap, gap
print("catalog subjects ok", len(names), "covers subjects.json", len(subj))
PY
fi
if [[ "$fail" -ne 0 ]]; then
echo "REVIEW FAIL"
exit 1
fi
echo "REVIEW PASS (no deploy)"