diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 271f8ca..8e6b9ec 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -7,6 +7,12 @@ "commands": [ "nbgv" ] + }, + "dotnet-reportgenerator-globaltool": { + "version": "5.5.11", + "commands": [ + "reportgenerator" + ] } } } \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1c444eb..168d497 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,7 +16,6 @@ jobs: name: Build SlnUp if: "!contains(github.event.head_commit.message, 'ci skip')" uses: ./.github/workflows/workflow_build.yml - secrets: inherit with: # don't check format on CI builds due to common breaking changes in the .NET SDK checkFormat: false diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 2d4fa2b..0a676c3 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -15,7 +15,6 @@ jobs: { os: macos, buildAgent: macos-14 } ] uses: ./.github/workflows/workflow_build.yml - secrets: inherit with: artifactSuffix: ${{ matrix.platform.os }} buildAgent: ${{ matrix.platform.buildAgent }} diff --git a/.github/workflows/workflow_build.yml b/.github/workflows/workflow_build.yml index 747fd71..c76d48f 100644 --- a/.github/workflows/workflow_build.yml +++ b/.github/workflows/workflow_build.yml @@ -61,20 +61,29 @@ jobs: - name: Test run: dotnet test --configuration Release --no-build --verbosity normal --coverage --coverage-output-format cobertura - - name: Install dotnet-coverage tool - run: dotnet tool install --global dotnet-coverage - - - name: Merge coverage reports - run: dotnet-coverage merge __artifacts/test-results/**/*.cobertura.xml -f cobertura -o __artifacts/test-results/codecov/coverage.cobertura.xml - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v7 + - name: Generate coverage report and enforce thresholds + run: > + dotnet tool run reportgenerator + "-reports:__artifacts/test-results/**/*.cobertura.xml" + "-targetdir:__artifacts/coverage-report" + "-reporttypes:MarkdownSummaryGithub;Html" + "-classfilters:-System.Text.RegularExpressions.Generated*" + "minimumCoverageThresholds:lineCoverage=95" + "minimumCoverageThresholds:branchCoverage=95" + + - name: Publish coverage summary + # Publish even when the threshold check above fails the build. + if: ${{ !cancelled() && hashFiles('__artifacts/coverage-report/SummaryGithub.md') != '' }} + shell: pwsh + run: Get-Content __artifacts/coverage-report/SummaryGithub.md | Add-Content -Path $env:GITHUB_STEP_SUMMARY + + - name: Upload coverage report + if: ${{ !cancelled() && hashFiles('__artifacts/coverage-report/SummaryGithub.md') != '' }} + uses: actions/upload-artifact@v7 with: - name: codecov - directory: __artifacts/test-results/codecov - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true - verbose: true + name: coverage-report_${{ inputs.artifactSuffix }} + path: __artifacts/coverage-report + retention-days: 14 - name: Upload package artifact if: ${{ inputs.uploadArtifacts }} diff --git a/README.md b/README.md index 2561c48..4ca2e95 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ that allows you to easily change the Visual Studio version information in a solution file using a Visual Studio version number. ![CI Build](https://github.com/craigktreasure/SlnUp/workflows/SlnUp-CI/badge.svg?branch=main) -[![codecov](https://codecov.io/gh/craigktreasure/SlnUp/branch/main/graph/badge.svg?token=SV8DFLV2H4)](https://codecov.io/gh/craigktreasure/SlnUp) [![NuGet](https://img.shields.io/nuget/v/SlnUp)](https://www.nuget.org/packages/SlnUp/) [![NuGet](https://img.shields.io/nuget/dt/SlnUp)](https://www.nuget.org/packages/SlnUp/) diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 5b9f2b1..0000000 --- a/codecov.yml +++ /dev/null @@ -1,6 +0,0 @@ -coverage: - status: - project: - default: - target: 95% - threshold: 1%