Repository navigation
54 lines (43 loc) · 2.36 KB
/
Copy pathcodecoverage.yml
File metadata and controls
54 lines (43 loc) · 2.36 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
name: Code Coverage
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Code Coverage
env:
ASPNETCORE_ENVIRONMENT: Production
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore Nuget Packages
run: dotnet restore MessagingService.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
- name: Build Code
run: dotnet build MessagingService.sln --configuration Release --no-restore
- name: Run Unit Tests
run: |
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
dotnet run --project "MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj" --configuration Release --no-build -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory "./coverage/businesslogic"
dotnet run --project "MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj" --configuration Release --no-build -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory "./coverage/emailaggregate"
dotnet run --project "MessagingService.SMSAggregate.Tests/MessagingService.SMSAggregate.Tests.csproj" --configuration Release --no-build -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory "./coverage/smsaggregate"
#dotnet run --project "MessagingService.Tests/MessagingService.Tests.csproj" --configuration Release --no-build -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory "./coverage/tests"
- name: Merge Coverage Reports
uses: danielpalme/ReportGenerator-GitHub-Action@v5
with:
reports: ./coverage/**/*.cobertura.xml
targetdir: ./coverage-report
reporttypes: Cobertura
- name: Upload coverage to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./coverage-report/Cobertura.xml