Upload jacocoTestReport data to sonarcloud using github actions

Hi,

I’m trying to upload my test reports to sonarcloud. I did go through these two links:
-[Coverage & Test Data] Importing JaCoCo coverage report in XML format
-How to configure/upload coverage reports to SonarCloud.io?

But when I run this command “./gradlew jacocoTestReport sonarqube” I get the following error:
“You are running CI analysis while Automatic Analysis is enabled. Please consider disabling one or the other.”

Now I know why I’m getting this error and that is because we currently run sonarcloud on every PR push on github. Now as a team we like the sonarcloud analysis

Screen Shot 2021-02-17 at 1.24.09 PM

But as you can see I’m missing coverage information. So my question is if I disable sonarcloud automatic analysis and run sonarqube command would we see the results of the code coverage along with the rest of analysis on the PR in github (just like the screenshot but with coverage data)? If not then how can I upload my coverage data to sonarcloud? Because from my understanding is that sonarqube is different than sonarcloud. qube we need to host it and obviously cloud is hosted by sonar so how can sonarqube command allow me to upload to sonarcloud?

1 Like

Welcome to the community!

Oh yes. If you disable automatic analysis and you provide the coverage report correctly, then you will get the same kind of output, with coverage information included.

Our online documentation has a dedicated page for this topic, see Test Coverage & Execution. I have a feeling your question might be related to the sonarqube part in the command ./gradlew jacocoTestReport sonarqube. It may seem strange that the command is called sonarqube, but indeed it’s the correct one. With sonar.host.url configured as https://sonarcloud.io/, the command will analyze your project using the analyzers of SonarCloud, and upload the analysis report there, with test coverage data included as you would expect.

1 Like

@janos thank you for your reply but I’m facing a blocker. The admin on my team is unable to disable automatic analysis. Please refer to this post How to disable auto scan - #8 by karimfikani and I did not get any reply. Can you please help? Thx!