-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun
More file actions
60 lines (50 loc) · 1.39 KB
/
run
File metadata and controls
60 lines (50 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
# Cross-platform task runner (Git Bash on Windows, bash on Linux/macOS).
# Usage: ./run <target>
#
# Override the Python interpreter:
# PYTHON=python3.12 ./run cov
set -euo pipefail
PYTHON="${PYTHON:-python}"
target="${1:-help}"
case "$target" in
install)
"$PYTHON" -m pip install -e ".[dev]"
;;
test)
"$PYTHON" -m pytest tests/ -v
;;
cov)
"$PYTHON" -m pytest tests/ \
--cov=paperscout \
--cov-report=term-missing \
--cov-report=xml \
--cov-fail-under=90 \
-v
;;
check)
# Alias for cov -- run this before every push
exec "$0" cov
;;
clean)
rm -f coverage.xml .coverage
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
;;
help|--help|-h)
echo "Usage: ./run <target>"
echo ""
echo "Targets:"
echo " install Install the package and dev dependencies"
echo " test Run tests (fast, no coverage)"
echo " cov Run tests with coverage (enforces 90% floor)"
echo " check Alias for cov -- run before pushing"
echo " clean Remove coverage artefacts and caches"
;;
*)
echo "Unknown target: $target" >&2
echo "Run './run help' for usage." >&2
exit 1
;;
esac