-
Notifications
You must be signed in to change notification settings - Fork 6
58 lines (52 loc) · 1.8 KB
/
Copy pathdotnet.yml
File metadata and controls
58 lines (52 loc) · 1.8 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
53
54
55
56
57
58
# CI de PR/push: build + testes da solution completa.
name: .NET
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
- name: Coverage gate
# Ratchet: começa em 45% (cobertura atual ~47%) e deve SUBIR conforme a
# suíte crescer — nunca baixar. Falha o CI se a cobertura de linhas dos
# assemblies Codout.* cair abaixo do piso.
run: |
python3 - <<'EOF'
import glob, sys, xml.etree.ElementTree as ET
THRESHOLD = 45.0
hit = total = 0
for f in glob.glob('coverage/**/coverage.cobertura.xml', recursive=True):
for pkg in ET.parse(f).getroot().iter('package'):
if not pkg.get('name', '').startswith(('Codout', 'Softprime')):
continue
for line in pkg.iter('line'):
total += 1
hit += int(line.get('hits', '0')) > 0
pct = 100 * hit / total if total else 0.0
print(f'Cobertura de linhas (Codout.*): {pct:.1f}% (piso: {THRESHOLD}%)')
sys.exit(0 if pct >= THRESHOLD else 1)
EOF
- name: Upload coverage
uses: actions/upload-artifact@v7
if: always()
with:
name: coverage
path: ./coverage
retention-days: 14