ci(pegasus): separate test and gate metrics
This commit is contained in:
parent
c841dfe824
commit
ed7af57d00
@ -25,6 +25,7 @@ from pathlib import Path
|
|||||||
SOURCE_SCAN_ROOTS = ("backend", "frontend/src", "scripts", "testing")
|
SOURCE_SCAN_ROOTS = ("backend", "frontend/src", "scripts", "testing")
|
||||||
SOURCE_EXTENSIONS = {".go", ".py", ".ts", ".tsx", ".sh"}
|
SOURCE_EXTENSIONS = {".go", ".py", ".ts", ".tsx", ".sh"}
|
||||||
QUALITY_SUCCESS_STATES = {"ok", "pass", "passed", "success", "compliant"}
|
QUALITY_SUCCESS_STATES = {"ok", "pass", "passed", "success", "compliant"}
|
||||||
|
STYLE_ISSUE_CHECKS = {"go-doc", "ts-doc", "go-vet", "tsc", "docs", "naming", "docs_naming", "hygiene", "lint"}
|
||||||
|
|
||||||
|
|
||||||
def _escape_label(value: str) -> str:
|
def _escape_label(value: str) -> str:
|
||||||
@ -197,6 +198,8 @@ def _count_source_files_over_limit(repo_root: Path, max_lines: int = 500) -> int
|
|||||||
continue
|
continue
|
||||||
if path.suffix not in SOURCE_EXTENSIONS:
|
if path.suffix not in SOURCE_EXTENSIONS:
|
||||||
continue
|
continue
|
||||||
|
if path.name.endswith("_test.go") or path.name.endswith(".test.ts") or path.name.endswith(".test.tsx"):
|
||||||
|
continue
|
||||||
lines = len(path.read_text(encoding="utf-8", errors="ignore").splitlines())
|
lines = len(path.read_text(encoding="utf-8", errors="ignore").splitlines())
|
||||||
if lines > max_lines:
|
if lines > max_lines:
|
||||||
count += 1
|
count += 1
|
||||||
@ -304,21 +307,24 @@ def main() -> int:
|
|||||||
gate_ok = bool(gate_summary.get("ok"))
|
gate_ok = bool(gate_summary.get("ok"))
|
||||||
gate_issues = gate_summary.get("issues") or []
|
gate_issues = gate_summary.get("issues") or []
|
||||||
source_lines_over_500 = _count_source_files_over_limit(repo_root, max_lines=500)
|
source_lines_over_500 = _count_source_files_over_limit(repo_root, max_lines=500)
|
||||||
outcome = (
|
issue_checks = {
|
||||||
"ok"
|
str(issue.get("check") or "").strip().lower()
|
||||||
if gate_ok
|
for issue in gate_issues
|
||||||
and backend_rc == 0
|
if isinstance(issue, dict)
|
||||||
|
}
|
||||||
|
tests_ok = (
|
||||||
|
backend_rc == 0
|
||||||
and frontend_rc == 0
|
and frontend_rc == 0
|
||||||
and totals["tests"] > 0
|
and totals["tests"] > 0
|
||||||
and totals["failures"] == 0
|
and totals["failures"] == 0
|
||||||
and totals["errors"] == 0
|
and totals["errors"] == 0
|
||||||
else "failed"
|
|
||||||
)
|
)
|
||||||
|
outcome = "ok" if gate_ok and tests_ok else "failed"
|
||||||
checks = {
|
checks = {
|
||||||
"tests": "ok" if outcome == "ok" else "failed",
|
"tests": "ok" if tests_ok else "failed",
|
||||||
"coverage": "ok" if coverage_pct >= 95.0 else "failed",
|
"coverage": "ok" if coverage_pct >= 95.0 and "coverage" not in issue_checks else "failed",
|
||||||
"loc": "ok" if source_lines_over_500 == 0 else "failed",
|
"loc": "ok" if source_lines_over_500 == 0 and "loc" not in issue_checks else "failed",
|
||||||
"docs_naming": "ok" if not gate_issues else "failed",
|
"docs_naming": "ok" if not (issue_checks & STYLE_ISSUE_CHECKS) else "failed",
|
||||||
"gate_glue": "ok",
|
"gate_glue": "ok",
|
||||||
"sonarqube": _sonarqube_check_status(build_dir),
|
"sonarqube": _sonarqube_check_status(build_dir),
|
||||||
"supply_chain": _supply_chain_check_status(build_dir),
|
"supply_chain": _supply_chain_check_status(build_dir),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user