#!/bin/sh # Lantern judge — the build gate on the actual Rust repo. # Compiles, runs the contract tests, and prints FAIL lines naming the file # so the build-gate mail lands on the right desk. Slow-but-strict is the brand. set -u cd "$(dirname "$0")" cargo build --quiet 2>&1 | head -30 if [ $? -ne 0 ]; then echo "FAIL src/main.rs: cargo build — compile error (see output above)" exit 1 fi cargo test --quiet 2>&1 | tail -25 # Smoke: the daemon skeleton must at least *start*. (headless run if possible) ok=0 if cargo build --quiet 2>/dev/null; then (./target/debug/harnessd > /tmp/harnessd.log 2>&1 & echo $! > /tmp/harnessd.pid) sleep 1 if command -v curl >/dev/null 2>&1; then if curl -sf http://127.0.0.1:7777/healthz >/dev/null 2>&1; then echo "PASS smoke: /healthz reachable" ok=1 else echo "FAIL src/main.rs: smoke — /healthz did not respond on 0.0.0.0:7777" fi fi kill "$(cat /tmp/harnessd.pid)" 2>/dev/null fi echo "lantern judge: build + tests + smoke ($ok = smoke ok)" exit $ok