aries-cloudagent-python icon indicating copy to clipboard operation
aries-cloudagent-python copied to clipboard

Sonarcloud with code coverage

Open jamshale opened this issue 9 months ago • 2 comments

This is used to get code coverage for our sonarcloud integration on PR's and when code is pushed to main.

The complication comes with using the sonarcloud token from forked repos. I have tested using two github accounts and forking my fork.

This works by saving the test report from the PR Tests workflow as an artifact and also the pr number. Then when the PR Tests workflow completes successfully a workflow will begin for sonarcloud witch gets information about the forked repo, and fetches the code for the scan. The code coverage is downloaded from the artifact, updated and then upload to sonarcloud.

Another workflow runs the tests on merge to main, runs the scan and uploads results. I thought about doing this as one workflow but decided separate workflows was actually much simpler.

I changed the workflow Tests to an action and adjusted the other workflows that used it. When calling from the push to main workflow it was having trouble as a workflow.

Requires disabling Automatic Analysis in the sonarcloud admin console. You can't use automatic and manage it from CI at the same time. Also won't exist until the workflows have been merged to main.

Main branch:

image

PR (Failing):

The required coverage can be adjusted in sonarcloud console.

image

image

image

PR (Passing):

image

jamshale avatar May 24 '24 19:05 jamshale