From d7b9f81e53a857389b312931141740fce9561548 Mon Sep 17 00:00:00 2001 From: Ben Stull Date: Wed, 10 Jun 2026 08:39:14 -0700 Subject: [PATCH] =?UTF-8?q?feat(slice-1):=20scripts/check.sh=20=E2=80=94?= =?UTF-8?q?=20the=20single=20gate=20(lint-imports,=20pytest,=20frontend=20?= =?UTF-8?q?build)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/check.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 scripts/check.sh diff --git a/scripts/check.sh b/scripts/check.sh new file mode 100755 index 0000000..cf6d605 --- /dev/null +++ b/scripts/check.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# The single pre-merge gate for wiggleverse-ecomm (SD-0001 ยง6.8). Runs, in order: +# 1. the import-linter layering contract (main > domains > platform) +# 2. the backend test suite (pytest, against Postgres) +# 3. the frontend typecheck + production build +# CI (.gitea/workflows/ci.yml) calls this exact script, so local and server gates +# cannot drift. Exits non-zero on the first failure. +# +# Requires a reachable Postgres for the backend tests: locally the compose service +# (scripts/dev.sh brings it up); in CI a Postgres service container. Override its +# admin DSN with ECOMM_TEST_ADMIN_URL. +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +# Pick an interpreter: explicit $PYTHON (CI), else the repo venv, else PATH. +if [ -n "${PYTHON:-}" ]; then + PY="$PYTHON" +elif [ -x "$repo_root/.venv/bin/python" ]; then + PY="$repo_root/.venv/bin/python" +else + PY="$(command -v python3 || command -v python)" +fi + +lint="$(dirname "$PY")/lint-imports" +[ -x "$lint" ] || lint="lint-imports" + +echo "==> import boundaries (lint-imports)" +( cd "$repo_root/backend" && "$lint" ) + +echo "==> backend tests (pytest)" +( cd "$repo_root/backend" && "$PY" -m pytest -q ) + +echo "==> frontend typecheck + build" +( cd "$repo_root/frontend" && npm run build ) + +echo "==> all gates green"