Skip to content

Commit 76e5be2

Browse files
Update coverage workflow for Coverlet console
1 parent 8c71862 commit 76e5be2

2 files changed

Lines changed: 227 additions & 223 deletions

File tree

‎.github/workflows/codecoverage.yml‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,27 @@ jobs:
2323

2424
- name: Build Code
2525
run: dotnet build TransactionProcessor.sln --configuration Release
26-
27-
- name: Run Unit Tests
26+
27+
- name: Install Coverlet console
2828
run: |
29-
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
30-
dotnet test "TransactionProcessor.BusinessLogic.Tests\TransactionProcessor.BusinessLogic.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-
dotnet test "TransactionProcessor.ProjectionEngine.Tests\TransactionProcessor.ProjectionEngine.Tests.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"
32-
dotnet test "TransactionProcessor.Aggregates.Tests\TransactionProcessor.Aggregates.Tests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov3.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
33-
dotnet test "TransactionProcessor.Tests\TransactionProcessor.Tests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov4.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
34-
dotnet test "TransactionProcessor.DatabaseTests\TransactionProcessor.DatabaseTests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov5.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
29+
dotnet tool install --global coverlet.console --version 6.0.4
30+
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
3531
3632
- name: Install LCOV merger
3733
run: npm install -g lcov-result-merger
34+
- name: Run Unit Tests
35+
run: |
36+
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
37+
mkdir -p coverage
38+
coverlet TransactionProcessor.BusinessLogic.Tests/bin/Release/net10.0/TransactionProcessor.BusinessLogic.Tests.dll --target dotnet --targetargs "TransactionProcessor.BusinessLogic.Tests/bin/Release/net10.0/TransactionProcessor.BusinessLogic.Tests.dll" --format lcov --output coverage/lcov1.info --exclude "[xunit*]*" --exclude-by-attribute Obsolete --exclude-by-attribute GeneratedCodeAttribute --exclude-by-attribute CompilerGeneratedAttribute --exclude-by-attribute ExcludeFromCodeCoverageAttribute
39+
coverlet TransactionProcessor.ProjectionEngine.Tests/bin/Release/net10.0/TransactionProcessor.ProjectionEngine.Tests.dll --target dotnet --targetargs "TransactionProcessor.ProjectionEngine.Tests/bin/Release/net10.0/TransactionProcessor.ProjectionEngine.Tests.dll" --format lcov --output coverage/lcov2.info --exclude "[xunit*]*" --exclude-by-attribute Obsolete --exclude-by-attribute GeneratedCodeAttribute --exclude-by-attribute CompilerGeneratedAttribute --exclude-by-attribute ExcludeFromCodeCoverageAttribute
40+
coverlet TransactionProcessor.Aggregates.Tests/bin/Release/net10.0/TransactionProcessor.Aggregates.Tests.dll --target dotnet --targetargs "TransactionProcessor.Aggregates.Tests/bin/Release/net10.0/TransactionProcessor.Aggregates.Tests.dll" --format lcov --output coverage/lcov3.info --exclude "[xunit*]*" --exclude-by-attribute Obsolete --exclude-by-attribute GeneratedCodeAttribute --exclude-by-attribute CompilerGeneratedAttribute --exclude-by-attribute ExcludeFromCodeCoverageAttribute
41+
coverlet TransactionProcessor.Tests/bin/Release/net10.0/TransactionProcessor.Tests.dll --target dotnet --targetargs "TransactionProcessor.Tests/bin/Release/net10.0/TransactionProcessor.Tests.dll" --format lcov --output coverage/lcov4.info --exclude "[xunit*]*" --exclude-by-attribute Obsolete --exclude-by-attribute GeneratedCodeAttribute --exclude-by-attribute CompilerGeneratedAttribute --exclude-by-attribute ExcludeFromCodeCoverageAttribute
42+
coverlet TransactionProcessor.DatabaseTests/bin/Release/net10.0/TransactionProcessor.DatabaseTests.dll --target dotnet --targetargs "TransactionProcessor.DatabaseTests/bin/Release/net10.0/TransactionProcessor.DatabaseTests.dll" --format lcov --output coverage/lcov5.info --exclude "[xunit*]*" --exclude-by-attribute Obsolete --exclude-by-attribute GeneratedCodeAttribute --exclude-by-attribute CompilerGeneratedAttribute --exclude-by-attribute ExcludeFromCodeCoverageAttribute
3843
3944
- name: Merge LCOV reports
4045
run: |
41-
mkdir -p coverage
42-
lcov-result-merger "*.info" > lcov.info
46+
lcov-result-merger "coverage/*.info" > lcov.info
4347
4448
- name: Upload merged coverage to Codacy
4549
uses: codacy/codacy-coverage-reporter-action@v1

0 commit comments

Comments
 (0)