Skip to content

Commit 676fbf2

Browse files
authored
(#364) Output code coverage reports as step summary (#365)
* (#364) Output code coverage reports as step summary * (#364) Removed test assemblies from code coverage consideration.
1 parent eb51454 commit 676fbf2

File tree

1 file changed

+28
-57
lines changed

1 file changed

+28
-57
lines changed

.github/workflows/build-library.yml

Lines changed: 28 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,33 @@ jobs:
8383
-p:PackageVersion=$BUILD_VERSION
8484
-p:Version=$BUILD_VERSION
8585
--no-build
86-
--verbosity minimal
87-
--logger trx --collect:"XPlat Code Coverage"
86+
--verbosity minimal
87+
--logger trx
88+
--collect:"XPlat Code Coverage"
89+
90+
- name: Combine coverage reports
91+
uses: danielpalme/[email protected]
92+
with:
93+
reports: "**/coverage.cobertura.xml"
94+
assemblyfilters: "-*Test*"
95+
targetdir: "${{ github.workspace }}/TestResults"
96+
reporttypes: "Cobertura;lcov;MarkdownSummaryGithub"
97+
verbosity: "Info"
98+
title: "Code Coverage"
99+
tag: "${{ github.run_number }}_${{ github.run_id }}"
100+
customSettings: ""
101+
toolpath: "reportgeneratortool"
102+
103+
- name: Add code coverage summary to job
104+
if: always()
105+
run: cat "${{ github.workspace }}/TestResults/SummaryGithub.md" >> $GITHUB_STEP_SUMMARY
106+
107+
- name: Upload code coverage reports
108+
uses: actions/upload-artifact@v4
109+
with:
110+
name: coverage
111+
path: ${{ github.workspace }}/TestResults
112+
retention-days: 7
88113

89114
- name: Pack NuGet libraries
90115
run: >
@@ -110,61 +135,7 @@ jobs:
110135
if-no-files-found: error
111136
path: |
112137
${{ github.workspace }}/.github/workflows/SignedPackageFileList.txt
113-
114-
- name: Upload test results
115-
if: always()
116-
uses: actions/upload-artifact@v4
117-
with:
118-
name: test-results
119-
if-no-files-found: error
120-
path: ${{ github.workspace }}/**/TestResults/*.trx
121-
retention-days: 7
122-
123-
# - name: Publish test results
124-
# uses: EnricoMi/[email protected]
125-
# if: ${{ always() && github.event_name == 'pull_request' }}
126-
# with:
127-
# files: "${{ github.workspace }}/**/*.trx"
128-
129-
- name: Combine coverage reports
130-
uses: danielpalme/[email protected]
131-
with:
132-
reports: "**/*.cobertura.xml"
133-
targetdir: "${{ github.workspace }}"
134-
reporttypes: "Cobertura"
135-
verbosity: "Info"
136-
title: "Code Coverage"
137-
tag: "${{ github.run_number }}_${{ github.run_id }}"
138-
customSettings: ""
139-
toolpath: "reportgeneratortool"
140-
141-
- name: Upload combined coverage XML
142-
uses: actions/upload-artifact@v4
143-
with:
144-
name: coverage
145-
path: ${{ github.workspace }}/Cobertura.xml
146-
retention-days: 7
147-
148-
- name: Publish code coverage report
149-
uses: irongut/[email protected]
150-
with:
151-
filename: "Cobertura.xml"
152-
badge: true
153-
fail_below_min: false
154-
format: markdown
155-
hide_branch_rate: false
156-
hide_complexity: false
157-
indicators: true
158-
output: both
159-
thresholds: "10 30"
160-
161-
- name: Upload combined coverage markdown
162-
uses: actions/upload-artifact@v4
163-
with:
164-
name: coverage-markdown
165-
path: ${{ github.workspace }}/code-coverage-results.md
166-
retention-days: 7
167-
138+
168139
sign:
169140
needs: [build]
170141
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}

0 commit comments

Comments
 (0)