codeclimate-action
codeclimate-action copied to clipboard
CoveragePy Formatter not found.
Describe the bug I'm attempting to use this action to report pytest results on a flask application. After the tests successfully run, the after-build job cannot find the CoveragePy package to use as a formatter.
Version
v2.7.4
Example links
- Error run with debug on https://github.com/bcgov/mines-digital-trust/runs/1533132459?check_suite_focus=true
Expected behaviour
coveragePY command runs the testsuite, but the cc-test-reporter after-build
command doesn't find it. It is the supported python package by code climate. https://docs.codeclimate.com/docs/configuring-test-coverage
@Jsyro the error message tells me the CodeClimate reporter cannot figure out how to format your coverage output.
Are you able to upload the coverage manually after your tests run using the CC reporter manually? You can follow the documentation — https://docs.codeclimate.com/docs/test-coverage-troubleshooting-tips
I am probably too late here 😬 but would like to answer how I resolved it.
@Jsyro I had the same issue.
You should run the coverage run
command first, ( can be a separate step) then run coverage report
via coverageCommand
parameter with the action in the next step.
The coverage report
command looks for the coverage.xml
file to be present in the same folder to generate the report. I used the following commands stepwise to upload the result to code climate, and it worked.
- name: Generate the coverage report
run: |
coverage run --source=test -m pytest
coverage xml -o coverage.xml # explicitely exporting coverage file to be read by coverage report command.
- name: Publish code coverage to code climate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: YOUR_REPO_REPORTER_ID
with:
coverageCommand: coverage report
This will upload your report to code climate.
@paambaati is it possible to cover some more examples in the doc or README?
@abhishekmishragithub I'd love it if you can send a PR for this!
@paambaati for adding an example in README.md?
for adding an example in README.md?
Yes.
for adding an example in README.md?
Yes.
Sure. will do a tiny PR for it soon. Thanks ✌🏼