ci: match coverage paths from Cobertura reports
Heimdall Gitea / Detect CI scope (pull_request) Successful in 4s
Heimdall Gitea / Build and tests (pull_request) Failing after 9m33s
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Failing after 3s

This commit is contained in:
Arnaud Dartois committed 2026-10-25 10:41:30 +01:00
1 parent 4661837110
commit c384c1ea3f
1 file changed
+3 -1
+3 -1
View File
@@ -25,11 +25,13 @@ TARGETS = {
def coverage_for(path: Path, target: str) -> tuple[int, int]:
covered = valid = 0
target_name = Path(target).name
target_suffix = target.removeprefix("src/")
for report in path.rglob("coverage.cobertura.xml"):
root = ET.parse(report).getroot()
for item in root.iter("class"):
filename = item.get("filename", "").replace("\\", "/")
if not filename.endswith(target):
if not (filename.endswith(target) or filename.endswith(target_suffix) or Path(filename).name == target_name):
continue
lines = item.findall("./lines/line")
valid += len(lines)