From 7b615d58c4f05b31cd256622a3afb7ea0cd78f1a Mon Sep 17 00:00:00 2001 From: Adrian Hall Date: Fri, 23 May 2025 12:55:45 -0700 Subject: [PATCH 1/3] (#364) Output code coverage reports as step summary --- .github/workflows/build-library.yml | 84 ++++++++++------------------- 1 file changed, 27 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build-library.yml b/.github/workflows/build-library.yml index 94ea691..5cb8b65 100644 --- a/.github/workflows/build-library.yml +++ b/.github/workflows/build-library.yml @@ -83,8 +83,32 @@ jobs: -p:PackageVersion=$BUILD_VERSION -p:Version=$BUILD_VERSION --no-build - --verbosity minimal - --logger trx --collect:"XPlat Code Coverage" + --verbosity minimal + --logger trx + --collect:"XPlat Code Coverage" + + - name: Combine coverage reports + uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4 + with: + reports: "**/*.cobertura.xml" + targetdir: "${{ github.workspace }}/TestResults" + reporttypes: "Cobertura;lcov;MarkdownSummaryGithub" + verbosity: "Info" + title: "Code Coverage" + tag: "${{ github.run_number }}_${{ github.run_id }}" + customSettings: "" + toolpath: "reportgeneratortool" + + - name: Add code coverage summary to job + if: always() + run: cat "${{ github.workspace }}/TestResults/SummaryGitHub.md" >> $GITHUB_STEP_SUMMARY + + - name: Upload code coverage reports + uses: actions/upload-artifact@v4 + with: + name: coverage + path: ${{ github.workspace }}/TestResults + retention-days: 7 - name: Pack NuGet libraries run: > @@ -110,61 +134,7 @@ jobs: if-no-files-found: error path: | ${{ github.workspace }}/.github/workflows/SignedPackageFileList.txt - - - name: Upload test results - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-results - if-no-files-found: error - path: ${{ github.workspace }}/**/TestResults/*.trx - retention-days: 7 - - # - name: Publish test results - # uses: EnricoMi/publish-unit-test-result-action@v2.18.0 - # if: ${{ always() && github.event_name == 'pull_request' }} - # with: - # files: "${{ github.workspace }}/**/*.trx" - - - name: Combine coverage reports - uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4 - with: - reports: "**/*.cobertura.xml" - targetdir: "${{ github.workspace }}" - reporttypes: "Cobertura" - verbosity: "Info" - title: "Code Coverage" - tag: "${{ github.run_number }}_${{ github.run_id }}" - customSettings: "" - toolpath: "reportgeneratortool" - - - name: Upload combined coverage XML - uses: actions/upload-artifact@v4 - with: - name: coverage - path: ${{ github.workspace }}/Cobertura.xml - retention-days: 7 - - - name: Publish code coverage report - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: "Cobertura.xml" - badge: true - fail_below_min: false - format: markdown - hide_branch_rate: false - hide_complexity: false - indicators: true - output: both - thresholds: "10 30" - - - name: Upload combined coverage markdown - uses: actions/upload-artifact@v4 - with: - name: coverage-markdown - path: ${{ github.workspace }}/code-coverage-results.md - retention-days: 7 - + sign: needs: [build] if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }} From 1fe1082cf71cacc8170c2f321a2a3ef4a37ae8a0 Mon Sep 17 00:00:00 2001 From: Adrian Hall Date: Fri, 23 May 2025 13:07:56 -0700 Subject: [PATCH 2/3] (#364) Corrected casing on the summary file. --- .github/workflows/build-library.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-library.yml b/.github/workflows/build-library.yml index 5cb8b65..aad951d 100644 --- a/.github/workflows/build-library.yml +++ b/.github/workflows/build-library.yml @@ -101,7 +101,7 @@ jobs: - name: Add code coverage summary to job if: always() - run: cat "${{ github.workspace }}/TestResults/SummaryGitHub.md" >> $GITHUB_STEP_SUMMARY + run: cat "${{ github.workspace }}/TestResults/SummaryGithub.md" >> $GITHUB_STEP_SUMMARY - name: Upload code coverage reports uses: actions/upload-artifact@v4 From af35709b079ac712869a1f05263d05c3bae3fea5 Mon Sep 17 00:00:00 2001 From: Adrian Hall Date: Fri, 23 May 2025 13:35:16 -0700 Subject: [PATCH 3/3] (#364) Removed test assemblies from code coverage consideration. --- .github/workflows/build-library.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-library.yml b/.github/workflows/build-library.yml index aad951d..f26cc1a 100644 --- a/.github/workflows/build-library.yml +++ b/.github/workflows/build-library.yml @@ -90,7 +90,8 @@ jobs: - name: Combine coverage reports uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4 with: - reports: "**/*.cobertura.xml" + reports: "**/coverage.cobertura.xml" + assemblyfilters: "-*Test*" targetdir: "${{ github.workspace }}/TestResults" reporttypes: "Cobertura;lcov;MarkdownSummaryGithub" verbosity: "Info"