Skip to content

(#364) Output code coverage reports as step summary #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 28 additions & 57 deletions .github/workflows/build-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,33 @@ 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/[email protected]
with:
reports: "**/coverage.cobertura.xml"
assemblyfilters: "-*Test*"
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: >
Expand All @@ -110,61 +135,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/[email protected]
# if: ${{ always() && github.event_name == 'pull_request' }}
# with:
# files: "${{ github.workspace }}/**/*.trx"

- name: Combine coverage reports
uses: danielpalme/[email protected]
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/[email protected]
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/') }}
Expand Down