Repository navigation
Expand file tree
/
Copy pathci
More file actions
executable file
·39 lines (38 loc) · 2 KB
/
Copy pathci
File metadata and controls
executable file
·39 lines (38 loc) · 2 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
#!/bin/sh
# The full check, the one entry point CI runs. `--fast` runs everything but the tests, in seconds:
# the pre-push hook runs that, and GitHub runs the full check on every ready pull request and on
# main after each merge. Keep it free of CI-only setup (checkout, caching). Order: cheapest first,
# fail fast.
set -eu
cd "$(dirname "$0")/.."
echo "==> ruff check"; uv run ruff check .
echo "==> ruff format --check"; uv run ruff format --check .
echo "==> mypy (strict)"; uv run mypy
sh scripts/lint-workflows
if [ "${1:-}" = "--fast" ]; then
echo "==> openspec validate"; npx --no-install openspec validate --all --strict --no-interactive
echo "==> fast check passed (no tests: CI runs them)"
exit 0
fi
echo "==> unit tests: 100% branch coverage of core"
COVERAGE_FILE=.coverage-unit uv run coverage run -m pytest -q tests/unit
COVERAGE_FILE=.coverage-unit uv run coverage report --include='*/core/*' --fail-under=100
# Linux gates the total at 100%. Windows skips the specs that need the executable bit or an `sh`
# stub, so a line only those specs reach cannot be covered there: it keeps the floor of 95%.
case "$(uname -s)" in
MINGW*|MSYS*|CYGWIN*) floor=95 ;;
*) floor=100 ;;
esac
echo "==> all tests: ${floor}% branch coverage overall"
# In parallel on CI only: GitHub's runners have the cores, and the integration specs spend their
# time in git processes. Locally the count of cores can lie (a container limited to 2 CPUs sees all
# of the host's), and too many workers stall the machine. The unit tests stay serial: they take a
# second, less than starting the workers.
if [ -n "${CI:-}" ]; then workers="-n auto"; else workers=""; fi
# shellcheck disable=SC2086 # $workers is empty or two words
uv run coverage run -m pytest -q $workers
uv run coverage report --fail-under="$floor" --skip-covered
echo "==> built wheel starts in an empty environment"
sh scripts/check-wheel
echo "==> openspec validate"; npx --no-install openspec validate --all --strict --no-interactive
echo "==> full check passed"