Skip to content

Commit 971cb63

Browse files
committed
Explicitly generate coverage data file for Codecov
The v1 version of the `codecov/codecov-action` action automatically generated the data file via `coverage xml`, but the latest v2 does not, which causes it to fail: ``` [2022-01-05T09:53:02.481Z] ['info'] Searching for coverage files... [2022-01-05T09:53:02.501Z] ['error'] There was an error running the uploader: Error while cleaning paths. No paths matched existing files! Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v2.1.0/dist/codecov' failed with exit code 255 ``` It also seems better to have full control over the process by doing it explicitly rather than relying on an action which is used primarily to handle the data upload to Codecov.
1 parent 66b3491 commit 971cb63

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.github/workflows/libraries_report-size-deltas.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
env:
1919
PYTHON_PROJECT_PATH: ${GITHUB_WORKSPACE}/reportsizedeltas
2020
PYTHON_PROJECT_TESTS_PATH: ${GITHUB_WORKSPACE}/reportsizedeltas/tests
21+
COVERAGE_DATA_FILENAME: coverage.xml
2122

2223
steps:
2324
- name: Checkout
@@ -43,11 +44,14 @@ jobs:
4344
run: |
4445
export PYTHONPATH="${{ env.PYTHON_PROJECT_PATH }}"
4546
coverage run --source="${{ env.PYTHON_PROJECT_PATH }}" --module pytest "${{ env.PYTHON_PROJECT_TESTS_PATH }}"
47+
# Generate coverage data file for consumption by `codecov/codecov-action`.
48+
coverage xml -o "${{ github.workspace }}/${{ env.COVERAGE_DATA_FILENAME }}"
4649
4750
- name: Display code coverage report
4851
run: coverage report
4952

5053
- name: Upload coverage report to Codecov
5154
uses: codecov/codecov-action@v1
5255
with:
56+
file: ${{ env.COVERAGE_DATA_FILENAME }}
5357
fail_ci_if_error: true

0 commit comments

Comments
 (0)