I am using Github actions to run tests for my python project. I am using coverage to generate coverage report (with pytest). Everything (path) is based locally on the machine Github Actions is running on (
On the coverage report, it has an attribute source which list the source of the code
<sources> <source>/home/runner/work/repo</source> </sources>
But when running the Sonar scan using Github Actions (SonarSource/sonarcloud-github-action@master), it is executed in a docker container, with the volume of the “source” mounted to a separate location
Log from the docker commend on Github Action
When the Soner Scanner is running, it is reporting that the source path is invalid because it is using the github local path, not the path relative to the docker container.
WARN: Invalid directory path in 'source' element: /home/runner/work/repo
I previously have it setup in CircleCI and it ran without issue because it downloads the scanner locally and run it, but with the switch to the Github Actions, the way it execute changed, causing the coverage report to not being recognized by Sonar Scanner due to the path change.