railyard/scripts/ci/scratch-postgres-stop.sh
caelum0x 1c742a7c93 ci: test every Rust app and the Node suites, with a scratch Postgres
CI ran cargo for rago, mint and some relay crates only, without a database,
and no Node suite at all: the live money-path suites (rago pg-tests, mint's
ignored live tests, vend, abacus, turnstile, ledgerline, passport, relay
storage/traces, game-economy) never ran, nor did the console, product
analytics, insights-edge, the SDK packages or the Scribase bridge contract.

- scripts/ci/scratch-postgres.sh starts a throwaway cluster per job from the
  runner's initdb (skips cleanly when Postgres is not installed) and exports
  DATABASE_URL (plus TURNSTILE_/RELAY_TEST_DATABASE_URL); a stop script
  removes it.
- The Rust matrix adds ledgerline, vend, abacus, turnstile, toolgate,
  game-economy, agent-runtime, context-passport and relay-storage-postgres /
  relay-traces; rago runs with pg-tests; mint runs its live suites.
- A node job runs the console, product analytics test:all, insights-edge, the
  SDK packages (borrowing product analytics' pinned SDK install) and the
  bridge contract.
- vend's Cargo.lock was stale (mint-payments gained ring), so
  'cargo test --locked' failed for vend; refreshed.

Verified locally against a scratch database: vend 136, abacus 95, turnstile
92, toolgate 114, context-passport 58 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 16:04:27 +03:00

9 lines
423 B
Bash
Executable File

#!/usr/bin/env bash
# Stop and remove the cluster scripts/ci/scratch-postgres.sh started.
set -uo pipefail
data="${SCRATCH_PG_DATA:-}"
[ -n "$data" ] && [ -d "$data" ] || exit 0
pg_ctl=$(command -v pg_ctl || ls /opt/homebrew/opt/postgresql@17/bin/pg_ctl /opt/homebrew/bin/pg_ctl 2>/dev/null | head -1)
[ -n "$pg_ctl" ] && "$pg_ctl" -D "$data" -m fast stop >/dev/null 2>&1
rm -rf "$data" "${data%/*}/pg-sock-${data##*/pg-}"