@@ -178,21 +178,26 @@ jobs:
178178 ls -aR .coverage*
179179 coverage combine .coverage*
180180 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
185183
186184 # For future use in case we want to add a PR comment for 3rd party PRs which requires
187185 # a workflow with elevated PR write permissions. Move below steps into a separate job.
188186 - name : Archive code coverage report
187+ id : cov_xml_upload
189188 uses : actions/upload-artifact@v4
190189 with :
191190 name : coverage
192191 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
193196
194197 - name : Code Coverage Report
195198 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 != '' }}
196201 with :
197202 filename : coverage.xml
198203 badge : true
@@ -202,15 +207,20 @@ jobs:
202207 hide_complexity : true
203208 indicators : true
204209 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'
206212
207213 - name : Add Coverage PR Comment
208214 uses : marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.3
209215 # Create PR comment when the branch is on the repo, otherwise we lack PR write permissions
210216 # -> need another workflow with access to secret token
211217 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+ }}
214224 with :
215225 hide_and_recreate : true
216226 path : code-coverage-results.md
0 commit comments