mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-06 21:02:04 +00:00
ci: enforce tui2 and core api coverage thresholds
This commit is contained in:
1 parent
c1a317f9b6
commit
b77c887446
8 files changed
+102
-7
No files matched your search
@@ -19,6 +19,7 @@ from pathlib import Path
|
||||
DEFAULT_THRESHOLDS: dict[str, float] = {
|
||||
"src/main.py": 50.0,
|
||||
"src/seedpass/core/manager.py": 60.0,
|
||||
"src/seedpass/core/api.py": 85.0,
|
||||
"src/seedpass/core/encryption.py": 80.0,
|
||||
"src/seedpass/core/migrations.py": 90.0,
|
||||
}
|
||||
|
||||
+12
-2
@@ -5,6 +5,11 @@ mkdir -p artifacts/coverage
|
||||
|
||||
./scripts/tui2_check_smoke.sh
|
||||
|
||||
py_bin="python"
|
||||
if ! command -v "$py_bin" >/dev/null 2>&1; then
|
||||
py_bin="python3"
|
||||
fi
|
||||
|
||||
if [[ "${DETERMINISM_GATE:-1}" == "1" ]]; then
|
||||
./scripts/run_determinism_tests.sh
|
||||
fi
|
||||
@@ -48,7 +53,12 @@ if [[ $status -eq 124 ]]; then
|
||||
tail -n 20 pytest.log
|
||||
exit 1
|
||||
fi
|
||||
if [[ $status -eq 0 && "${CRITICAL_COVERAGE_GATE:-0}" == "1" ]]; then
|
||||
python scripts/check_critical_coverage.py artifacts/coverage/coverage.json
|
||||
if [[ $status -eq 0 && "${CRITICAL_COVERAGE_GATE:-1}" == "1" ]]; then
|
||||
"$py_bin" scripts/check_critical_coverage.py \
|
||||
artifacts/coverage/coverage.json \
|
||||
--json-output artifacts/coverage/critical_gate.full.json
|
||||
fi
|
||||
if [[ $status -eq 0 && "${TUI2_COVERAGE_GATE:-1}" == "1" ]]; then
|
||||
./scripts/tui2_coverage_gate.sh
|
||||
fi
|
||||
exit $status
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
mkdir -p artifacts/coverage
|
||||
|
||||
if [[ -x ".venv/bin/python" ]]; then
|
||||
py_bin=".venv/bin/python"
|
||||
elif command -v python >/dev/null 2>&1; then
|
||||
py_bin="python"
|
||||
else
|
||||
py_bin="python3"
|
||||
fi
|
||||
|
||||
if ! "$py_bin" - <<'PY' >/dev/null 2>&1
|
||||
import importlib.util
|
||||
raise SystemExit(0 if importlib.util.find_spec("textual") else 1)
|
||||
PY
|
||||
then
|
||||
if [[ "${REQUIRE_TEXTUAL:-0}" == "1" ]]; then
|
||||
echo "Error: textual runtime is unavailable; cannot run TUI v2 coverage gate." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "tui2 coverage gate: skipped (textual runtime unavailable)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
"$py_bin" -m pytest -q \
|
||||
--cov=src \
|
||||
--cov-report=json:artifacts/coverage/coverage.tui2_gate.json \
|
||||
src/tests/test_tui_v2_helpers.py \
|
||||
src/tests/test_tui_v2_textual_interactions.py \
|
||||
src/tests/test_tui_v2_action_matrix.py \
|
||||
src/tests/test_tui_v2_parity_scenarios.py \
|
||||
src/tests/test_core_api_services.py
|
||||
|
||||
"$py_bin" scripts/check_critical_coverage.py \
|
||||
artifacts/coverage/coverage.tui2_gate.json \
|
||||
--no-default-thresholds \
|
||||
--threshold src/seedpass/tui_v2/app.py=78 \
|
||||
--threshold src/seedpass/core/api.py=85 \
|
||||
--json-output artifacts/coverage/critical_gate.tui2.json
|
||||
|
||||
echo "tui2 coverage gate: ok"
|
||||
Reference in new issue
Block a user