Workflow tweaking #5906
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Code test and analysis (fork) | |
| on: | |
| pull_request: | |
| jobs: | |
| test: | |
| if: github.repository_owner == 'Altinn' && (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true) | |
| name: Build and Test | |
| runs-on: windows-latest | |
| steps: | |
| - name: Enable long paths for git on Windows | |
| run: git config --system core.longpaths true | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
| - name: dotnet build | |
| run: dotnet build solutions/All.sln -v m | |
| - name: dotnet test | |
| run: dotnet test solutions/All.sln --no-restore --no-build --results-directory TestResults/ --collect:"XPlat Code Coverage" --filter "Category!=Integration" -v m | |
| - name: Generate coverage results | |
| run: | | |
| dotnet tool install --global dotnet-reportgenerator-globaltool | |
| reportgenerator -reports:TestResults/**/coverage.cobertura.xml -targetdir:TestResults/Output/CoverageReport -reporttypes:Cobertura | |
| - name: Archive code coverage results | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: code-coverage-report | |
| path: TestResults/Output/CoverageReport/ | |
| code-coverage: | |
| if: github.repository_owner == 'Altinn' && (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) | |
| name: Report code coverage | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Download Coverage Results | |
| uses: actions/download-artifact@2a5974104b6d5dbdb2f9468a3e54da3bdd241578 # master | |
| with: | |
| name: code-coverage-report | |
| path: dist/ | |
| - name: Create Coverage Summary Report | |
| uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0 | |
| with: | |
| filename: dist/Cobertura.xml | |
| badge: true | |
| fail_below_min: true | |
| format: markdown | |
| hide_branch_rate: false | |
| hide_complexity: true | |
| indicators: true | |
| output: both | |
| thresholds: '60 80' | |
| - name: Add Coverage PR Comment | |
| uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 # v3.0.4 | |
| with: | |
| recreate: true | |
| path: code-coverage-results.md |