Automating coverage results using Github Actions

Hello all,

Forgive me if this has been answered. I’ve searched the docs and community but the answer eludes me. We use GitHub and GitHub Actions in our build process and rely on test results in our build environment to review PRs for our applications. We have SonarCloud installed as a GitHub App so it automatically runs.

Can code coverage results be uploaded to SonarCloud as they are created in our CI environment rather than committing them to the various repositories? Are there any workarounds so we aren’t required to commit coverage results?

Thanks for your time,
Steve

Welcome to the community!

Absolutely! The recommendation is to generate the coverage reports before you execute the scanner, without committing them. So you need to add a step (within the same job) before the SonarCloud GitHub Action to generate the reports, so that the files will exist by the time the scanner runs.

I hope this helps. I signal to our teams to improve our documentation on this topic.