ci: always publish Ariadne gate metrics even on missing artifacts

This commit is contained in:
Brad Stein 2026-04-19 14:40:11 -03:00
parent bbb958b7c5
commit a57577e2a5

View File

@ -15,6 +15,7 @@ MIN_METRIC_FIELDS = 2
SOURCE_SCAN_ROOTS = ("ariadne", "scripts", "testing")
SOURCE_EXTENSIONS = {".py", ".sh"}
QUALITY_SUCCESS_STATES = {"ok", "pass", "passed", "success", "compliant"}
COVERAGE_GATE_TARGET_PERCENT = 95.0
def _escape_label(value: str) -> str:
@ -173,14 +174,13 @@ def main() -> int:
build_number = os.getenv("BUILD_NUMBER", "")
commit = os.getenv("GIT_COMMIT", "")
if not os.path.exists(coverage_path):
raise RuntimeError(f"missing coverage file {coverage_path}")
if not os.path.exists(junit_path):
raise RuntimeError(f"missing junit file {junit_path}")
coverage = _load_coverage(coverage_path)
coverage = 0.0
if os.path.exists(coverage_path):
coverage = _load_coverage(coverage_path)
source_lines_over_500 = _count_source_files_over_limit(repo_root, max_lines=500)
totals = _load_junit(junit_path)
totals = {"tests": 0, "failures": 0, "errors": 0, "skipped": 0}
if os.path.exists(junit_path):
totals = _load_junit(junit_path)
passed = max(totals["tests"] - totals["failures"] - totals["errors"] - totals["skipped"], 0)
outcome = "ok"
@ -188,7 +188,7 @@ def main() -> int:
outcome = "failed"
checks = {
"tests": "ok" if outcome == "ok" else "failed",
"coverage": "ok" if coverage >= 95.0 else "failed",
"coverage": "ok" if coverage >= COVERAGE_GATE_TARGET_PERCENT else "failed",
"loc": "ok" if source_lines_over_500 == 0 else "failed",
"docs_naming": "not_applicable",
"gate_glue": "ok",