-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.sh
More file actions
executable file
·52 lines (39 loc) · 1.21 KB
/
check.sh
File metadata and controls
executable file
·52 lines (39 loc) · 1.21 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
#!/usr/bin/env bash
# Run the same checks as .github/workflows/ci.yml locally, in the same order.
# Stops at the first failure. If this script is green, CI should be green too.
#
# Uses uv to manage the project venv and CI dependencies. Install uv first:
# curl -LsSf https://astral.sh/uv/install.sh | sh
#
# Usage:
# ./scripts/check.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$ROOT_DIR"
if ! command -v uv > /dev/null; then
echo "Error: 'uv' is not installed." >&2
echo "Install: https://docs.astral.sh/uv/getting-started/installation/" >&2
exit 1
fi
if [[ ! -x ".venv/bin/python" ]]; then
printf "\n==> Creating .venv (uv venv --seed)\n"
uv venv --seed
fi
printf "\n==> Syncing CI dependencies\n"
uv pip install --python .venv/bin/python -e ".[ci]" build
PY=".venv/bin/python"
step() {
printf "\n==> %s\n" "$1"
}
step "Lint (Ruff)"
"$PY" -m ruff check .
step "Format check (Black)"
"$PY" -m black --check src examples tests
step "Type check (MyPy)"
"$PY" -m mypy --install-types --non-interactive
step "Build package (sdist + wheel)"
"$PY" -m build
step "Run tests (pytest)"
"$PY" -m pytest -q
printf "\nAll CI checks passed.\n"