Skip to content

Commit 989b989

Browse files
committed
chore(baseline): add index/enrich/serve-smoke pipeline capture
1 parent abe4a70 commit 989b989

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

scripts/baseline/run-pipeline.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env bash
2+
# Usage: run-pipeline.sh <seed-name>
3+
# Runs index, enrich, (brief) serve-smoke against a seed repo, captures timings + stats.
4+
set -euo pipefail
5+
NAME="${1:?seed name required (e.g. spring-petclinic)}"
6+
SEED=".seeds/$NAME"
7+
OUT="docs/superpowers/baselines/2026-04-17/raw/pipeline/$NAME"
8+
mkdir -p "$OUT"
9+
10+
JAR="$(ls target/code-iq-*-cli.jar 2>/dev/null | head -n1 || true)"
11+
if [[ -z "$JAR" ]]; then
12+
echo "[pipeline] CLI jar not found; running: mvn -B -DskipTests package"
13+
mvn -B -DskipTests package
14+
JAR="$(ls target/code-iq-*-cli.jar | head -n1)"
15+
fi
16+
17+
[[ -d "$SEED" ]] || { echo "Seed $SEED missing. Run scripts/seed-repos.sh first."; exit 1; }
18+
19+
# Clean any prior state in the seed repo.
20+
rm -rf "$SEED/.code-intelligence" "$SEED/.osscodeiq"
21+
22+
timer() {
23+
local label="$1"; shift
24+
local t0=$(date +%s)
25+
"$@" > "$OUT/$label.log" 2>&1
26+
local rc=$?
27+
local t1=$(date +%s)
28+
echo "$label duration=$((t1-t0))s rc=$rc" | tee -a "$OUT/timings.txt"
29+
return $rc
30+
}
31+
32+
timer index java -jar "$JAR" index "$SEED"
33+
timer enrich java -jar "$JAR" enrich "$SEED"
34+
35+
# Serve-smoke: start server, hit /actuator/health and /api/stats, stop.
36+
PORT=18080
37+
java -jar "$JAR" serve "$SEED" --port "$PORT" > "$OUT/serve.log" 2>&1 &
38+
PID=$!
39+
trap "kill $PID 2>/dev/null || true" EXIT
40+
sleep 8
41+
if curl -sf "http://127.0.0.1:$PORT/actuator/health" > "$OUT/health.json"; then
42+
echo "health=ok" >> "$OUT/timings.txt"
43+
else
44+
echo "health=fail" >> "$OUT/timings.txt"
45+
fi
46+
curl -sf "http://127.0.0.1:$PORT/api/stats" > "$OUT/stats.json" || true
47+
kill $PID 2>/dev/null || true
48+
wait $PID 2>/dev/null || true
49+
50+
# Summarize.
51+
python3 - <<PY > "$OUT/summary.json"
52+
import json, os
53+
def load(p):
54+
try: return json.load(open(p))
55+
except Exception: return None
56+
t=open("$OUT/timings.txt").read().strip().splitlines()
57+
print(json.dumps({
58+
"seed": "$NAME",
59+
"timings": t,
60+
"stats": load("$OUT/stats.json"),
61+
"health_ok": load("$OUT/health.json") is not None,
62+
}, indent=2))
63+
PY
64+
cat "$OUT/summary.json"

0 commit comments

Comments
 (0)