Skip to content

Commit c41445b

Browse files
authored
Merge pull request #74 from per1234/coverage-report-from-task
Generate standard code coverage report data file in `python:test` task
2 parents c3a24a4 + 9bd380a commit c41445b

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

Diff for: .github/workflows/test-python-poetry-task.yml

+1-12
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ jobs:
7272
permissions:
7373
contents: read
7474

75-
env:
76-
COVERAGE_DATA_FILENAME: coverage.xml
77-
7875
steps:
7976
- name: Checkout repository
8077
uses: actions/checkout@v4
@@ -102,14 +99,6 @@ jobs:
10299
- name: Display code coverage report
103100
run: task python:coverage-report
104101

105-
# codecov/codecov-action only makes the conversion if the `coverage` package is installed in the global runner
106-
# environment
107-
- name: Convert code coverage report to format required by Codecov
108-
run: |
109-
poetry run \
110-
coverage xml \
111-
-o "${{ github.workspace }}/${{ env.COVERAGE_DATA_FILENAME }}"
112-
113102
# A token is used to avoid intermittent spurious job failures caused by rate limiting.
114103
- name: Set up Codecov upload token
115104
run: |
@@ -128,5 +117,5 @@ jobs:
128117
uses: codecov/codecov-action@v3
129118
with:
130119
fail_ci_if_error: true
131-
file: ${{ env.COVERAGE_DATA_FILENAME }}
120+
file: coverage.xml
132121
token: ${{ env.CODECOV_TOKEN }}

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/node_modules/
22
__pycache__/
33
.coverage
4+
/coverage.xml

Diff for: Taskfile.yml

+3
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ tasks:
272272
--source="{{.PYTHON_PROJECT_PATH}}" \
273273
--module \
274274
pytest "{{.PYTHON_PROJECT_PATH}}/tests"
275+
- |
276+
poetry run \
277+
coverage xml
275278
276279
# Make a temporary file named according to the passed TEMPLATE variable and print the path passed to stdout
277280
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/windows-task/Taskfile.yml

0 commit comments

Comments
 (0)