the report was generated in the step before, by running:
sbt compile coverage test assembly
sbt coverageAggregate
and I can confirm the report is there, and it shows the proper values.
However, when the action is executed in Github, I get:
INFO: Sensor Scoverage sensor for Scala coverage [sonarscala]
INFO: Importing /github/workspace/target/scala-2.12/scoverage-report/scoverage.xml
WARN: Fail to resolve 6 file(s). No coverage data will be imported on the following file(s): /home/runner/work/spark-td/spark-td/src/main/scala/io/split/td/mtks/CustomQueryListener.scala;/home/runner/work/spark-td/spark-td/src/main/scala/io/split/td/mtks/Sink.scala;/home/runner/work/spark-td/spark-td/src/main/scala/io/split/td/mtks/SinkConfig.scala;/home/runner/work/spark-td/spark-td/src/main/scala/io/split/td/util/config/StatsDInitializer.scala;/home/runner/work/spark-td/spark-td/src/main/scala/io/split/td/util/config/ssm.scala;/home/runner/work/spark-td/spark-td/src/main/scala/io/split/td/util/infra/metadata.scala
I have tried running a local copy of SonarQube comunity edition in a docker container, and push the report with sonar-scanner, and I get the expected results.
So the problem is either with the Github Action or with SonarQube Developer Edition.
Hi @cfadon,
Are you still facing the same issue? Can you check if the paths in the scoverage report are using an absolute path that might be specific to the Github Action environment?
Hello! Did you find a solution to that @cfadon ? We are facing the same issue.
Switching to use Sonar-Scala https://sonar-scala.com/ Works and we get the coverage in SonarCloud but not with the default sonarcloud-github-action plugin and Sonar-scala one does not have support for Scala 3 (what we need).
Any new ideas?
Thank you.
Then the sonar scanner is unable to match the format of the coverage file directories that it contains with the current directories for the files in the docker volume and it simply does not account it so coverage is marked to 0%.
Probably changing the volume docker internal directory to match what is used by GitHub actions will solve the problem.
As sbt-sonar plugin has a build-in Sonar scanner, it does not run in a docker container, there is no volume and directory change either, so it works smoothly.
This is an old topic and so far @JordiGiros’s solution seems to be the best way to go in a Github/Sonarcloud pipeline but I have opened a ticket to track this.