@@ -178,21 +178,26 @@ jobs:
178
178
ls -aR .coverage*
179
179
coverage combine .coverage*
180
180
echo "Creating coverage report..."
181
- # Create a coverage report (console)
182
- coverage report
183
- # Create xml file for further processing
184
- coverage xml
181
+ # Create xml file for further processing; Create even if below minimum
182
+ coverage xml --fail-under=0
185
183
186
184
# For future use in case we want to add a PR comment for 3rd party PRs which requires
187
185
# a workflow with elevated PR write permissions. Move below steps into a separate job.
188
186
- name : Archive code coverage report
187
+ id : cov_xml_upload
189
188
uses : actions/upload-artifact@v4
190
189
with :
191
190
name : coverage
192
191
path : coverage.xml
192
+ - name : Code Coverage Report (console)
193
+ run : |
194
+ # Create a coverage report (console), respects fail_under in pyproject.toml
195
+ coverage report
193
196
194
197
- name : Code Coverage Report
195
198
uses : irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0
199
+ # Create markdown file even if coverage report fails due to fail_under
200
+ if : ${{ always() && steps.cov_xml_upload.outputs.artifact-id != '' }}
196
201
with :
197
202
filename : coverage.xml
198
203
badge : true
@@ -202,15 +207,20 @@ jobs:
202
207
hide_complexity : true
203
208
indicators : true
204
209
output : both # console, file or both
205
- thresholds : ' 90 95'
210
+ # Note: it appears fail below min is one off, use fail_under -1 here
211
+ thresholds : ' 95 98'
206
212
207
213
- name : Add Coverage PR Comment
208
214
uses : marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.3
209
215
# Create PR comment when the branch is on the repo, otherwise we lack PR write permissions
210
216
# -> need another workflow with access to secret token
211
217
if : >-
212
- github.event_name == 'pull_request'
213
- && github.event.pull_request.head.repo.full_name == github.repository
218
+ ${{
219
+ always()
220
+ && github.event_name == 'pull_request'
221
+ && github.event.pull_request.head.repo.full_name == github.repository
222
+ && steps.cov_xml_upload.outputs.artifact-id != ''
223
+ }}
214
224
with :
215
225
hide_and_recreate : true
216
226
path : code-coverage-results.md
0 commit comments