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+ # The action searches for packages.lock.json in the repository root,
27+ # calculates their hash, and uses it as a part of the cache key.
28+ cache : true
3129
3230 - name : Restore dependencies
3331 run : dotnet restore
@@ -42,25 +40,25 @@ jobs:
4240 - name : Checkout repository
4341 uses : actions/checkout@v4
4442
45- - name : Run tests and collect code coverage (Cobertura)
43+ - name : Run tests and generate Cobertura coverage reports
4644 run : dotnet test --results-directory "coverage" --collect:"Code Coverage;Format=cobertura"
4745
4846 - name : Install dotnet-coverage tool
4947 run : dotnet tool install --global dotnet-coverage
5048
51- - name : Merge coverage reports
49+ - name : Merge Cobertura coverage reports
5250 run : dotnet-coverage merge coverage/**/*.cobertura.xml --output coverage/cobertura.xml --output-format cobertura
5351
5452 - name : Install ReportGenerator tool
5553 run : dotnet tool install --global dotnet-reportgenerator-globaltool
5654
57- - name : Generate Markdown summary
55+ - name : Generate Markdown summary of coverage report
5856 run : reportgenerator -reports:coverage/cobertura.xml -targetdir:coverage -reporttypes:"MarkdownSummaryGithub"
5957
60- - name : Display Markdown summary
58+ - name : Display Markdown summary of coverage report
6159 run : cat coverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
6260
63- - name : Upload coverage report artifact
61+ - name : Upload Cobertura coverage report artifact
6462 uses : actions/upload-artifact@v4
6563 with :
6664 name : cobertura.xml
@@ -71,26 +69,25 @@ jobs:
7169 runs-on : ubuntu-latest
7270 strategy :
7371 matrix :
74- service : [codecov, codacy] # Parallel jobs for Codecov and Codacy
72+ service : [codecov, codacy]
7573 steps :
7674 - name : Checkout repository
7775 uses : actions/checkout@v4
7876
79- - name : Download coverage report artifact
77+ - name : Download Cobertura coverage report artifact
8078 uses : actions/download-artifact@v4
8179 with :
8280 name : cobertura.xml
8381
84- - name : Upload coverage report to ${{ matrix.service }}
82+ - name : Upload Cobertura coverage report to ${{ matrix.service }}
8583 if : ${{ matrix.service == 'codecov' }}
8684 uses : codecov/codecov-action@v5.4.0
8785 with :
8886 token : ${{ secrets.CODECOV_TOKEN }}
8987 files : cobertura.xml
9088 use_oidc : false
91- verbose : true
9289
93- - name : Upload coverage report to ${{ matrix.service }}
90+ - name : Upload Cobertura coverage report to ${{ matrix.service }}
9491 if : ${{ matrix.service == 'codacy' }}
9592 uses : codacy/codacy-coverage-reporter-action@v1.3.0
9693 with :
0 commit comments