Automatic Analysis and Test reports

Template for a good new topic, formatted with Markdown:

  • ALM used - GitHub
  • CI system used - Automatic Analysis with GitHub
  • Scanner command used - none
  • Languages of the repository - C#, PHP, TS/JS (as a start?)
  • Only if the SonarCloud project is public, - Private Enterprise

We really like how easy and fast automatic analysis is within GitHub.

The documentation clearly states that test results/ coverage are not supported.

OK. But surely there must be a way to send these to sonar? We do a build and test and publish test results. So the files are there without having the start-scanner wrapper running.

You can’t mix automatic and CI so I take it I can’t just run a separate action with the scanner for test results only?

As a fairly big enterprise user. I feel like we are missing out here but happy to have a workaround implementation.

Does anybody have any insight on this? Would be very much appreciated for your help.

Right now, in the SonarCloud, the concept of asynchronously updating an existing analysis with more data simply doesn’t exist. We think it could make sense, but haven’t gotten around to finding the right implementation yet. There are quite a few “gotchas” to consider (how are you sure you’re updating the right analysis report? What happens if you accidentally send an old analysis report? When should the Quality Gate be computed? What if that data never gets sent?)

So right now, for any coverage data, you need CI-based analysis.

Feel free to add your voice to this roadmap item.

I could just run a CI-based analysis nightly to gather main branch coverage.
But I think that is going to shout at me saying automatic analysis is enabled?
So maybe that is the easy solution.

So really, all I need to do is trigger PR-level coverage blocks/ test result pass with GitHub actions very simply… I don’t need to gather those stats during the PR phases.

You only get to choose CI-based analysis or Automatic Analysis in a project. You can’t mix them (one for branch analysis, and one for PR analysis, for example).

I’m not quite sure I understand you here. But yes, if you handle all of this with GitHub Actions (generate a coverage report, parsing it, and breaking the build if it doesn’t meet your expectations), you could get around SonarCloud not supporting it for Automatic Analysis.