Hi everyone. I’m facing the following issue. I have a github repo that runs github actions when a new PR is created. It runs different sbt commands such as linting, unit testing, etc. For some reason I can’t publish my results to Sonar Cloud. The following list contains the details of the context where this is happening.
Hi @mickaelcaro
I added and pushed new code to each PR
this time sonar code analysis was triggered but it failed. Looks like the new code was detected, but test weren’t. I mean, both new methods are marked as uncovered by tests. If you check the tests, I added coverage for one of them.
00:13:38.413 WARN: Fail to resolve 2 file(s). No coverage data will be imported on the following file(s): /home/runner/work/rumble-on-scala/rumble-on-scala/src/main/scala/com/gaston/adder/Adder.scala;/home/runner/work/rumble-on-scala/rumble-on-scala/src/main/scala/com/gaston/adder/Subtractor.scala
It seems that there is a mismatch between the paths that are inside the coverage report vs what we detected with the scanner.
Hi @mickaelcaro. I found that sonar.tests where pointing to a wrong path. I fixed that and now the WARN is not being showed anymore. But sonar report still saying that there is no coverage. Not sure what am I missing here.
I run sonarqube community 8.4 in my localhost using docker and the report generated was ok. For some reason in my local environment, sonar-project.properties is not being detected, so I had to send the parameters through command line to make it work. Even though I tried to do the same in github, but it looks like it doesn’t make any difference. It stills saying no lines were covered by the tests.
Hey @mickaelcaro After trying different things, I could solve it. Not sure why https://github.com/SonarSource/sonarcloud-github-action is not working (maybe there is an issue with sbt or scala, not sure). Using the following sbt plugin https://sonar-scala.com/docs/setup/sbt-sonar/ was the only thing that worked. I have to generate a token in sonar cloud and add a new key named SONAR_TOKEN to my secrets in my github repo. This is how my github workflow yaml file looks