#!/bin/sh
# Lint + full offline test suite before every push (~1s).
# WAVI_NO_REPORT=1 keeps conftest from rewriting boarding.html/test_results.js.
# Bypass with: git push --no-verify
set -e

cd "$(git rev-parse --show-toplevel)"

if [ -x .venv/bin/python ]; then
    PY=.venv/bin/python
else
    PY=python3
fi

if [ -x .venv/bin/ruff ]; then
    echo "[pre-push] ruff check..."
    .venv/bin/ruff check wavi/ tests/ scripts/
fi

echo "[pre-push] pytest..."
WAVI_NO_REPORT=1 $PY -m pytest -q
