ci(ariadne): fallback to discovered junit/coverage paths
This commit is contained in:
parent
7e281e6548
commit
20fd0a9f38
@ -207,8 +207,8 @@ def _supply_chain_check_status(build_dir: Path) -> str:
|
||||
def main() -> int:
|
||||
repo_root = Path(__file__).resolve().parents[1]
|
||||
build_dir = repo_root / "build"
|
||||
coverage_path = os.getenv("COVERAGE_JSON", "build/coverage.json")
|
||||
junit_path = os.getenv("JUNIT_XML", "build/junit.xml")
|
||||
coverage_path = Path(os.getenv("COVERAGE_JSON", "build/coverage.json"))
|
||||
junit_path = Path(os.getenv("JUNIT_XML", "build/junit.xml"))
|
||||
pushgateway_url = os.getenv(
|
||||
"PUSHGATEWAY_URL", "http://platform-quality-gateway.monitoring.svc.cluster.local:9091"
|
||||
).strip()
|
||||
@ -217,16 +217,32 @@ def main() -> int:
|
||||
build_number = os.getenv("BUILD_NUMBER", "")
|
||||
commit = os.getenv("GIT_COMMIT", "")
|
||||
|
||||
if not coverage_path.exists():
|
||||
for candidate in (
|
||||
repo_root / "build" / "coverage.json",
|
||||
repo_root / "build" / "coverage-summary.json",
|
||||
repo_root / "build" / "coverage" / "coverage-summary.json",
|
||||
):
|
||||
if candidate.exists():
|
||||
coverage_path = candidate
|
||||
break
|
||||
if not junit_path.exists():
|
||||
junit_candidates = sorted((repo_root / "build").glob("junit*.xml"))
|
||||
if junit_candidates:
|
||||
junit_path = junit_candidates[0]
|
||||
print(f"[metrics] coverage_path={coverage_path} exists={coverage_path.exists()}")
|
||||
print(f"[metrics] junit_path={junit_path} exists={junit_path.exists()}")
|
||||
|
||||
coverage = 0.0
|
||||
if os.path.exists(coverage_path):
|
||||
coverage = _load_coverage(coverage_path)
|
||||
if coverage_path.exists():
|
||||
coverage = _load_coverage(str(coverage_path))
|
||||
docs_gate_rc = _load_gate_rc(Path(os.getenv("QUALITY_GATE_DOCS_RC_PATH", str(build_dir / "docs-naming.rc"))))
|
||||
source_lines_over_500 = _count_source_files_over_limit(repo_root, max_lines=500)
|
||||
totals = {"tests": 0, "failures": 0, "errors": 0, "skipped": 0}
|
||||
test_cases: list[tuple[str, str]] = []
|
||||
if os.path.exists(junit_path):
|
||||
totals = _load_junit(junit_path)
|
||||
test_cases = _load_junit_cases(junit_path)
|
||||
if junit_path.exists():
|
||||
totals = _load_junit(str(junit_path))
|
||||
test_cases = _load_junit_cases(str(junit_path))
|
||||
passed = max(totals["tests"] - totals["failures"] - totals["errors"] - totals["skipped"], 0)
|
||||
|
||||
outcome = "ok"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user