2626 python -m pip install --upgrade pip setuptools
2727 - name : Install dependencies
2828 run : |
29- python -m pip install coverage tox tox-py unittest-xml-reporting
29+ python -m pip install coverage[toml] tox tox-py unittest-xml-reporting
3030 - name : Run tox
3131 run : |
3232 python -m pip --version
@@ -35,12 +35,54 @@ jobs:
3535 - name : Coverage reporting
3636 run : |
3737 coverage combine
38- coverage report -m
39- coverage xml
40- coverage html
41- - name : Publish coverage results
42- uses : codecov/codecov-action@v4
38+ coverage report --show-missing
39+ mv .coverage .coverage.${{ matrix.python-version }}
40+ - name : Store coverage file
41+ uses : actions/upload-artifact@v4
42+ with :
43+ name : coverage-${{ matrix.python-version }}
44+ path : .coverage.${{ matrix.python-version }}
45+
46+ coverage :
47+ name : Coverage
48+ runs-on : ubuntu-latest
49+ needs : tests
50+ permissions :
51+ # If the author is a maintainer, the permission level is set by the
52+ # values below.
53+ # `pull-requests: write` is needed for publishing new comments in pull
54+ # requests.
55+ # `contents: write` is needed for pushing data to the
56+ # `python-coverage-comment-action` branch, and for editing existing
57+ # comments (to avoid publishing multiple comments in the same PR)
58+ # In case the pull request comes from a forked repository, the maximum
59+ # permission level is read, so the permissions below won't be acted upon
60+ # by GitHub.
61+ # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
62+ pull-requests : write
63+ contents : write
64+ steps :
65+ - uses : actions/checkout@v4
4366
67+ - uses : actions/download-artifact@v4
68+ id : download
69+ with :
70+ pattern : coverage-*
71+ merge-multiple : true
72+
73+ - name : Coverage comment
74+ id : coverage_comment
75+ uses : py-cov-action/python-coverage-comment-action@v3
76+ with :
77+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78+ MERGE_COVERAGE_FILES : true
79+
80+ - name : Store Pull Request comment to be posted
81+ uses : actions/upload-artifact@v4
82+ if : steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
83+ with :
84+ name : python-coverage-comment-action
85+ path : python-coverage-comment-action.txt
4486
4587 isort :
4688 runs-on : ubuntu-latest
0 commit comments