-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 1.7 KB
/
Copy pathci.yml
File metadata and controls
52 lines (44 loc) · 1.7 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Verify formatting
run: dotnet format --verify-no-changes --no-restore
# Unit + architecture tests need no Docker; the integration test uses
# Testcontainers against the Docker engine preinstalled on the runner.
- name: Test (with coverage)
run: >
dotnet test --no-build -c Release
--collect:"XPlat Code Coverage"
--results-directory ./coverage
- name: Coverage report + floor gate
run: |
dotnet tool install -g dotnet-reportgenerator-globaltool
export PATH="$PATH:$HOME/.dotnet/tools"
reportgenerator \
-reports:'./coverage/**/coverage.cobertura.xml' \
-targetdir:./coverage/report \
-reporttypes:'MarkdownSummaryGithub;JsonSummary' \
-assemblyfilters:'+DepRadar.*;-DepRadar.*.Tests'
cat ./coverage/report/SummaryGithub.md >> "$GITHUB_STEP_SUMMARY"
# Safety net, not a target: fail only on a large regression. Raise as coverage grows.
FLOOR=40
LINE=$(jq -r '.summary.linecoverage' ./coverage/report/Summary.json)
echo "Line coverage: ${LINE}% (floor ${FLOOR}%)"
awk "BEGIN{exit !(${LINE} >= ${FLOOR})}" \
|| { echo "::error::Line coverage ${LINE}% is below the ${FLOOR}% floor"; exit 1; }