99 pull_request :
1010 branches : [ "master" ]
1111
12+ env :
13+ DOTNET_VERSION : 8.0.x
14+
1215jobs :
1316 build :
1417 runs-on : ubuntu-latest
1518 steps :
1619 - name : Checkout repository
1720 uses : actions/checkout@v4
1821
19- - name : Set up .NET 8
22+ - name : Set up .NET ${{ env.DOTNET_VERSION }}
2023 uses : actions/setup-dotnet@v4
2124 with :
22- dotnet-version : 8.0.x
23-
24- - name : Cache NuGet packages
25- uses : actions/cache@v4
26- with :
27- path : ~/.nuget/packages
28- key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
29- restore-keys : |
30- ${{ runner.os }}-nuget-
25+ dotnet-version : ${{ env.DOTNET_VERSION }}
26+ cache : true
3127
3228 - name : Restore dependencies
3329 run : dotnet restore
@@ -42,25 +38,25 @@ jobs:
4238 - name : Checkout repository
4339 uses : actions/checkout@v4
4440
45- - name : Run tests and collect code coverage (Cobertura)
41+ - name : Run tests and generate Cobertura coverage reports
4642 run : dotnet test --results-directory "coverage" --collect:"Code Coverage;Format=cobertura"
4743
4844 - name : Install dotnet-coverage tool
4945 run : dotnet tool install --global dotnet-coverage
5046
51- - name : Merge coverage reports
47+ - name : Merge Cobertura coverage reports
5248 run : dotnet-coverage merge coverage/**/*.cobertura.xml --output coverage/cobertura.xml --output-format cobertura
5349
5450 - name : Install ReportGenerator tool
5551 run : dotnet tool install --global dotnet-reportgenerator-globaltool
5652
57- - name : Generate Markdown summary
53+ - name : Generate Markdown summary of coverage report
5854 run : reportgenerator -reports:coverage/cobertura.xml -targetdir:coverage -reporttypes:"MarkdownSummaryGithub"
5955
60- - name : Display Markdown summary
56+ - name : Display Markdown summary of coverage report
6157 run : cat coverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
6258
63- - name : Upload coverage report artifact
59+ - name : Upload Cobertura coverage report artifact
6460 uses : actions/upload-artifact@v4
6561 with :
6662 name : cobertura.xml
@@ -71,17 +67,17 @@ jobs:
7167 runs-on : ubuntu-latest
7268 strategy :
7369 matrix :
74- service : [codecov, codacy] # Parallel jobs for Codecov and Codacy
70+ service : [codecov, codacy]
7571 steps :
7672 - name : Checkout repository
7773 uses : actions/checkout@v4
7874
79- - name : Download coverage report artifact
75+ - name : Download Cobertura coverage report artifact
8076 uses : actions/download-artifact@v4
8177 with :
8278 name : cobertura.xml
8379
84- - name : Upload coverage report to ${{ matrix.service }}
80+ - name : Upload Cobertura coverage report to ${{ matrix.service }}
8581 if : ${{ matrix.service == 'codecov' }}
8682 uses : codecov/codecov-action@v5.4.0
8783 with :
9086 use_oidc : false
9187 verbose : true
9288
93- - name : Upload coverage report to ${{ matrix.service }}
89+ - name : Upload Cobertura coverage report to ${{ matrix.service }}
9490 if : ${{ matrix.service == 'codacy' }}
9591 uses : codacy/codacy-coverage-reporter-action@v1.3.0
9692 with :
0 commit comments