0% Coverage on Github Action Python CI

Hi team,

Sonar has been working great in our project for a few months already, but it was time that we tried to add coverage information! However, we are having some issues in making it get the right numbers, as both in PRs and main analysis, the coverage is marked at 0%, even when it is able to find the tests.

These are the files we are using:

The project is actually part of a monorepo, where we are already analysing Java and Typescript code without any issues. I also was able to set up sonarcloud for other projects (single repo) and while I am trying to follow the same recipe, I must be missing something!

The main references we were trying to use are:

At the beginning we were fixing issues related to the source path, but now the logs look alright (at least to me)

Would really appreciate any help here.

Thanks!

These are the latest logs we got from main: Sonar Base Path (#5189) · open-metadata/OpenMetadata@8fbac82 · GitHub

This is how we are running the coverage command: OpenMetadata/Makefile at main · open-metadata/OpenMetadata · GitHub

Thanks!

Hey there.

It sure looks like the report is being read in correctly:

INFO: Sensor Cobertura Sensor for Python coverage [python]
INFO: Python test coverage
INFO: Parsing report '/github/workspace/ingestion/coverage.xml'
INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=364ms

But the results look bizarre – since some files clearly have lines marked as being covered by tests – but they also appear to all be test files.

Could you run a cat ingestion/coverage.xml in your workflow to print out the coverage report? I think something fishy is going on…

Thanks @Colin for the help!

coverage.txt (161.3 KB)

Uploaded the coverage file (txt format because XML is not supported in the upload).

Let us know if there’s anything else we can share here!

Thanks

Hey there.

It sure looks like SonarCloud is accurately representing the information coming from your coverage report – in that the coverage report only seems to show coverage on test files rather than source files.

SonarCloud only reads the information from coverage reports – it isn’t involved in their production. You will probably need to go back to your coverage tool and make sure the report is being generated correctly / with the expected coverage data.

Thanks Colin, you’re right. The coverage file is not properly picking up the data. We’ll take a look at that.

Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.