-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.67 KB
/
codacy-coverage-report.yml
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
name: Upload coverage to Codacy
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/mssql/server
env:
SA_PASSWORD: "test-psw"
ACCEPT_EULA: "Y"
ports:
- 1433:1433
options: >-
--health-cmd "exit 0"
--health-interval 10s
--health-timeout 30s
--health-retries 5
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore
- name: Run tests with coverage
env:
ConnectionStrings__DefaultConnection: "Server=localhost,1433;Database=master;User Id=sa;Password=test-psw;Trusted_Connection=False;MultipleActiveResultSets=true;"
run: dotnet test --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage/ --settings coverage.runsettings
- name: Upload coverage to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: |
COBERTURA_FILE=$(find . -name coverage.cobertura.xml)
if [ -z "$COBERTURA_FILE" ]; then
echo "Coverage report not found!"
exit 1
fi
echo "Found coverage file at: ${COBERTURA_FILE}"
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r $COBERTURA_FILE