#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" PYTHON_BIN="${PYTHON_BIN:-${ROOT_DIR}/.venv/bin/python}" RUFF_BIN="${RUFF_BIN:-${ROOT_DIR}/.venv/bin/ruff}" NPM_BIN="${NPM_BIN:-npm}" require_command() { local command_name="$1" local hint="$2" if ! command -v "${command_name}" >/dev/null 2>&1; then echo "[verify] missing command: ${command_name}" >&2 echo "[verify] ${hint}" >&2 exit 1 fi } if [[ ! -x "${PYTHON_BIN}" ]]; then echo "[verify] missing python interpreter: ${PYTHON_BIN}" >&2 echo "[verify] create the virtualenv first, for example: python3 -m venv .venv && .venv/bin/pip install -r requirements.txt" >&2 exit 1 fi if [[ ! -x "${RUFF_BIN}" ]]; then echo "[verify] missing ruff binary: ${RUFF_BIN}" >&2 echo "[verify] install repo tooling into .venv before running this gate" >&2 exit 1 fi require_command "${NPM_BIN}" "install Node.js and npm before running frontend release checks" require_command "docker" "install Docker if you want the compose config sanity check to run" run_step() { local label="$1" shift echo "[verify] ${label}" ( cd "${ROOT_DIR}" "$@" ) } run_step "ruff" "${RUFF_BIN}" check . run_step "i18n drift" "${PYTHON_BIN}" scripts/check_i18n_drift.py run_step "django check" "${PYTHON_BIN}" manage.py check run_step "django tests" "${PYTHON_BIN}" manage.py test lobby fupogfakta --verbosity=1 run_step "shared frontend tests" "${NPM_BIN}" --prefix frontend test run_step "shared frontend build" "${NPM_BIN}" --prefix frontend run build run_step "angular tests" "${NPM_BIN}" --prefix frontend/angular test run_step "angular build" "${NPM_BIN}" --prefix frontend/angular run build run_step "docker compose config" bash -lc "cd \"${ROOT_DIR}\" && docker compose config >/dev/null" echo "[verify] MVP release gate passed"