File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Code Coverage
2+
3+ on :
4+ push :
5+ # branches to consider in the event; optional, defaults to all
6+ branches :
7+ - main
8+ workflow_dispatch :
9+
10+ jobs :
11+ codecoverage :
12+ name : " Code Coverage"
13+ env :
14+ ASPNETCORE_ENVIRONMENT : " Production"
15+
16+ runs-on : ubuntu-latest
17+
18+ steps :
19+ - uses : actions/checkout@v2.3.4
20+
21+ - name : Restore Nuget Packages
22+ run : dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
23+
24+ - name : Build Code
25+ run : dotnet build EstateReportingAPI.sln --configuration Release
26+
27+ - name : Run Unit Tests
28+ run : |
29+ echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
30+ dotnet test "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov1.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
31+
32+ - name : Build Docker Image
33+ run : docker build . --file EstateReportingAPI/Dockerfile --tag estatereportingapi:latest
34+
35+ - name : Run Integration Tests
36+ run : |
37+ dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov2.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
38+
39+ - name : Install LCOV merger
40+ run : npm install -g lcov-result-merger
41+
42+ - name : Merge LCOV reports
43+ run : |
44+ mkdir -p coverage
45+ lcov-result-merger "*.info" > lcov.info
46+
47+ - name : Upload merged coverage to Codacy
48+ uses : codacy/codacy-coverage-reporter-action@v1
49+ with :
50+ project-token : ${{ secrets.CODACY_PROJECT_TOKEN }}
51+ coverage-reports : ./lcov.info
Original file line number Diff line number Diff line change 3737 run : |
3838 dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov2.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
3939
40- - name : Install LCOV merger
41- run : npm install -g lcov-result-merger
42-
43- - name : Merge LCOV reports
44- run : |
45- mkdir -p coverage
46- lcov-result-merger "*.info" > lcov.info
47-
48- - name : Upload merged coverage to Codacy
49- uses : codacy/codacy-coverage-reporter-action@v1
50- with :
51- project-token : ${{ secrets.CODACY_PROJECT_TOKEN }}
52- coverage-reports : ./lcov.info
53-
5440 - uses : actions/upload-artifact@v4
5541 if : ${{ failure() }}
5642 with :
You can’t perform that action at this time.
0 commit comments