File tree Expand file tree Collapse file tree 3 files changed +28
-10
lines changed Expand file tree Collapse file tree 3 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ jobs:
205
205
with :
206
206
pattern : coverage-data-*
207
207
merge-multiple : true
208
+
208
209
- name : " Get coverage data & fail if it's <80%"
209
210
run : |
210
211
# if we decide to check cov across versions and combine
@@ -216,13 +217,29 @@ jobs:
216
217
217
218
# report again and fail if under 80%.
218
219
python -Im coverage report --fail-under=80
220
+
219
221
- name : " Upload HTML report if check failed 📤"
220
222
uses : actions/upload-artifact@v4
221
223
with :
222
224
name : html-report
223
225
path : htmlcov
224
226
if : ${{ failure() }}
225
227
228
+ # seems we need to call this from the main CI workflow first
229
+ - name : " Coverage comment 💬"
230
+ uses : py-cov-action/python-coverage-comment-action@v3
231
+ id : coverage_comment
232
+ with :
233
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
234
+
235
+ - name : " Store Pull Request comment to be posted 📤"
236
+ uses : actions/upload-artifact@v3
237
+ if : steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
238
+ with :
239
+ # leave default names
240
+ name : python-coverage-comment-action
241
+ path : python-coverage-comment-action.txt
242
+
226
243
profiling :
227
244
needs : [build-site, run-pytest]
228
245
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 10
10
test :
11
11
name : " Run tests & display coverage"
12
12
runs-on : ubuntu-latest
13
+ if : github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
13
14
permissions :
14
15
pull-requests : write
15
16
contents : write # needed to edit the comment vs opening multiple ones
22
23
route : GET /repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}
23
24
env :
24
25
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25
- - name : " Check if the trigger was a PR event"
26
- run : |
27
- TRIGGER_EVENT=$(echo '${{ steps.get-run.outputs.data }}' | jq -r '.event')
28
- if [[ "$TRIGGER_EVENT" != "pull_request" ]]; then
29
- echo "Workflow was not triggered by a PR, skipping coverage comment."
30
- exit 78 # Exiting with a neutral status
31
- fi
26
+
32
27
# this needs the .coverage file so we download from the CI workflow artifacts
33
28
- name : " Download coverage data 📥"
34
29
uses : actions/download-artifact@v4
37
32
merge-multiple : true
38
33
github-token : ${{ secrets.GITHUB_TOKEN }}
39
34
run-id : ${{ github.event.workflow_run.id }}
35
+
36
+ - name : " Check downloaded files"
37
+ run : ls -R
38
+
40
39
- name : " Post coverage comment"
41
40
uses : py-cov-action/python-coverage-comment-action@v3
42
41
with :
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ labels =
19
19
20
20
# general tox env configuration
21
21
# these can be run with any py3{9,12} version
22
- # tox run -e py39-lint
22
+ # tox run -e py39-lint
23
23
[testenv]
24
24
deps =
25
25
lint: pre-commit
@@ -41,9 +41,11 @@ commands =
41
41
# example tox run -e py39-profile-docs -- -o profile.svg -n 100
42
42
profile-docs: python ./tools/profile.py {posargs}
43
43
44
- # tests can be ran with or without coverage (see examples below), it is recommended to run compile before running tests (see examples below),
44
+ # tests can be ran with or without coverage (see examples below),
45
+ # it is recommended to run compile before running tests (see examples below),
45
46
# tox run -e compile,py39-tests
46
- # if you want to skip the assets compilation step you can run the tests without `compile`
47
+ # if you want to skip the assets compilation step you can run the tests without
48
+ # `compile`, for example:
47
49
# tox run -e py39-tests
48
50
# run tests with a specific Sphinx version
49
51
# tox run -e compile,py39-sphinx61-tests
You can’t perform that action at this time.
0 commit comments