- ci.yml: -warnaserror builds (NuGet audit included), Core coverage gate (80%), headless smoke test, translation check and a single `ci-ok` status for branch protection. - security.yml: vulnerable packages (JSON report checked explicitly), licence allowlist via nuget-license, gitleaks, actionlint and zizmor. - dependency-review.yml, dependency-submission.yml (full NuGet graph for Dependabot alerts) and scorecard.yml. - release.yml: manual release with a dry-run mode and PR dry runs; builds win, osx (arm64), osx-x64 and linux with vpk, smoke-tests every published build, checks package identity, updates a real 1.1.3 portable install with its own updater before anything is published, builds the NativeAOT CLI for four platforms, adds SBOMs, SHA256SUMS and build provenance, publishes draft-then-verify, then announces on Discord. - Notification workflows: explicit workflow names instead of "*", pinned to a commit of poli0981/.github, explicit secrets instead of inherit, fork runs filtered out; release-pineline.yml renamed. - dependabot.yml (NuGet, .NET SDK, Actions, grouped), CODEOWNERS, issue forms and a pull request template. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Fails when a package's line coverage in Cobertura reports is below a threshold.
|
|
|
|
python -I eng/coverage-gate.py <results-dir> <package> <minimum-percent>
|
|
|
|
Every *.cobertura.xml under <results-dir> is read; the package's best line rate counts (each test project reports the
|
|
assemblies it loaded, so HashTool.Core shows up in several reports with different coverage).
|
|
"""
|
|
|
|
import sys
|
|
import xml.etree.ElementTree as ElementTree
|
|
from pathlib import Path
|
|
|
|
|
|
def main(results: str, package: str, minimum: float) -> int:
|
|
rates = []
|
|
for report in Path(results).rglob("*.cobertura.xml"):
|
|
for element in ElementTree.parse(report).getroot().iter("package"):
|
|
if element.get("name") == package:
|
|
rates.append(float(element.get("line-rate", "0")) * 100)
|
|
if not rates:
|
|
print(f"::error::No coverage data for {package} under {results}")
|
|
return 1
|
|
best = max(rates)
|
|
print(f"{package}: {best:.1f}% line coverage (minimum {minimum:.0f}%)")
|
|
if best < minimum:
|
|
print(f"::error::{package} line coverage {best:.1f}% is below {minimum:.0f}%")
|
|
return 1
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) != 4:
|
|
print(__doc__)
|
|
sys.exit(2)
|
|
sys.exit(main(sys.argv[1], sys.argv[2], float(sys.argv[3])))
|