QuantumLearning/scripts/run_validation.sh

66 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
MODE="full"
usage() {
cat <<'EOF'
Usage: bash ./scripts/run_validation.sh [--quick|--standard|--full]
Validation modes:
--quick Ruff + pytest without browser/notebook execution suites.
--standard Ruff + full pytest suite.
--full Ruff + full pytest suite with coverage report. Default.
-h, --help Show this help.
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--quick)
MODE="quick"
shift
;;
--standard)
MODE="standard"
shift
;;
--full)
MODE="full"
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage >&2
exit 1
;;
esac
done
if [[ ! -x "$ROOT_DIR/.venv/bin/python" ]]; then
echo "Missing repo-local .venv. Run bash ./scripts/bootstrap_mac.sh first." >&2
exit 1
fi
cd "$ROOT_DIR"
source "$ROOT_DIR/.venv/bin/activate"
export PLAYWRIGHT_BROWSERS_PATH="$ROOT_DIR/.playwright-browsers"
ruff check src tests scripts
case "$MODE" in
quick)
python -m pytest -q -m "not browser and not notebook"
;;
standard)
python -m pytest -q
;;
full)
python -m pytest --cov=quantum_learning --cov-report=term-missing -q
;;
esac