Repository navigation
Expand file tree
/
Copy pathcoverage.sh
More file actions
28 lines (28 loc) · 1.72 KB
/
Copy pathcoverage.sh
File metadata and controls
28 lines (28 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
set -euo pipefail
mkdir -p artifacts/coverage/raw
# CI normalizes PDB paths. Resolve them back to this checkout without disabling
# source filtering or the 90% gate (Coverlet console does not create this map).
dotnet msbuild tests/ManagedCode.LlmTck.Tests/ManagedCode.LlmTck.Tests.csproj \
-nologo -target:InitializeSourceRootMappedPaths -getItem:SourceRoot \
-p:Configuration=Release -p:ContinuousIntegrationBuild=true > artifacts/coverage/source-roots.json
python3 - <<'PYMAP'
import json
from pathlib import Path
roots = json.loads(Path("artifacts/coverage/source-roots.json").read_text())["Items"]["SourceRoot"]
project = Path("tests/ManagedCode.LlmTck.Tests/ManagedCode.LlmTck.Tests.csproj").resolve()
Path("artifacts/coverage/source-roots.map").write_text("".join(
f"{project}|{root['Identity']}={root['MappedPath']}\n"
for root in roots if root.get("MappedPath")
))
PYMAP
dotnet tool run coverlet tests/ManagedCode.LlmTck.Tests/bin/Release/net10.0/ManagedCode.LlmTck.Tests.dll \
--target dotnet \
--targetargs "test --project tests/ManagedCode.LlmTck.Tests/ManagedCode.LlmTck.Tests.csproj --configuration Release --no-build --verbosity normal" \
--source-mapping-file artifacts/coverage/source-roots.map \
--format cobertura --format json --output artifacts/coverage/raw/coverage \
--include '[ManagedCode.LlmTck]*' --include '[ManagedCode.LlmTck.*]*' \
--exclude '[ManagedCode.LlmTck.Tests]*' --exclude '[ManagedCode.LlmTck.Service]*' --exclude '[ManagedCode.LlmTck.AppHost]*' \
--threshold 90 --threshold-type line --threshold-stat Total
dotnet tool run reportgenerator -reports:artifacts/coverage/raw/coverage.cobertura.xml \
-targetdir:artifacts/coverage/report '-reporttypes:HtmlSummary;TextSummary'