ci: publish LOC source file totals
This commit is contained in:
parent
fa468ae945
commit
4bd8d07bf1
@ -134,6 +134,12 @@ def _count_source_lines_over_500(root: Path) -> int:
|
||||
return over
|
||||
|
||||
|
||||
def _count_source_files(root: Path) -> int:
|
||||
if not root.exists():
|
||||
return 0
|
||||
return sum(1 for path in root.rglob("*.py") if path.is_file())
|
||||
|
||||
|
||||
def _load_json(path: Path) -> dict | None:
|
||||
if not path.exists():
|
||||
return None
|
||||
@ -259,6 +265,7 @@ def main() -> int:
|
||||
coverage_pct = _load_coverage_percent(coverage_path)
|
||||
gate_rc = _load_gate_rc(gate_rc_path)
|
||||
docs_rc = _load_gate_rc(docs_rc_path)
|
||||
source_files_total = _count_source_files(source_root)
|
||||
source_lines_over_500 = _count_source_lines_over_500(source_root)
|
||||
passed = max(totals["tests"] - totals["failures"] - totals["errors"] - totals["skipped"], 0)
|
||||
outcome = "ok" if totals["tests"] > 0 and totals["failures"] == 0 and totals["errors"] == 0 else "failed"
|
||||
@ -296,6 +303,8 @@ def main() -> int:
|
||||
f'atlasbot_quality_gate_coverage_percent{{suite="{suite}"}} {coverage_pct:.3f}',
|
||||
"# TYPE platform_quality_gate_workspace_line_coverage_percent gauge",
|
||||
f'platform_quality_gate_workspace_line_coverage_percent{{suite="{suite}"}} {coverage_pct:.3f}',
|
||||
"# TYPE platform_quality_gate_source_files_total gauge",
|
||||
f'platform_quality_gate_source_files_total{{suite="{suite}"}} {source_files_total}',
|
||||
"# TYPE platform_quality_gate_source_lines_over_500_total gauge",
|
||||
f'platform_quality_gate_source_lines_over_500_total{{suite="{suite}"}} {source_lines_over_500}',
|
||||
"# TYPE platform_quality_gate_build_info gauge",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user