ci: always publish Ariadne gate metrics even on missing artifacts
This commit is contained in:
parent
bbb958b7c5
commit
a57577e2a5
@ -15,6 +15,7 @@ MIN_METRIC_FIELDS = 2
|
|||||||
SOURCE_SCAN_ROOTS = ("ariadne", "scripts", "testing")
|
SOURCE_SCAN_ROOTS = ("ariadne", "scripts", "testing")
|
||||||
SOURCE_EXTENSIONS = {".py", ".sh"}
|
SOURCE_EXTENSIONS = {".py", ".sh"}
|
||||||
QUALITY_SUCCESS_STATES = {"ok", "pass", "passed", "success", "compliant"}
|
QUALITY_SUCCESS_STATES = {"ok", "pass", "passed", "success", "compliant"}
|
||||||
|
COVERAGE_GATE_TARGET_PERCENT = 95.0
|
||||||
|
|
||||||
|
|
||||||
def _escape_label(value: str) -> str:
|
def _escape_label(value: str) -> str:
|
||||||
@ -173,14 +174,13 @@ def main() -> int:
|
|||||||
build_number = os.getenv("BUILD_NUMBER", "")
|
build_number = os.getenv("BUILD_NUMBER", "")
|
||||||
commit = os.getenv("GIT_COMMIT", "")
|
commit = os.getenv("GIT_COMMIT", "")
|
||||||
|
|
||||||
if not os.path.exists(coverage_path):
|
coverage = 0.0
|
||||||
raise RuntimeError(f"missing coverage file {coverage_path}")
|
if os.path.exists(coverage_path):
|
||||||
if not os.path.exists(junit_path):
|
coverage = _load_coverage(coverage_path)
|
||||||
raise RuntimeError(f"missing junit file {junit_path}")
|
|
||||||
|
|
||||||
coverage = _load_coverage(coverage_path)
|
|
||||||
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)
|
||||||
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)
|
passed = max(totals["tests"] - totals["failures"] - totals["errors"] - totals["skipped"], 0)
|
||||||
|
|
||||||
outcome = "ok"
|
outcome = "ok"
|
||||||
@ -188,7 +188,7 @@ def main() -> int:
|
|||||||
outcome = "failed"
|
outcome = "failed"
|
||||||
checks = {
|
checks = {
|
||||||
"tests": "ok" if outcome == "ok" else "failed",
|
"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",
|
"loc": "ok" if source_lines_over_500 == 0 else "failed",
|
||||||
"docs_naming": "not_applicable",
|
"docs_naming": "not_applicable",
|
||||||
"gate_glue": "ok",
|
"gate_glue": "ok",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user