How can I split build and analysis + test execution

Hello !

We are using Azure Devops and Sonar Cloud, languages = C++

We have analysis pipelines which performs : downaload + install build wrapper, prepare sonar analysis, build with buildwrapper and msbuild, execute unit tests, convert report coverage to correct format and then run analysis.
This is working fine and we are able to see quality gates, code coverage etc

But, we would like to know : is it possible to split in 2 different stage or job the build part and the test execute part ?

Maybe by passing every build result from a stage to another, and then running analysis after test execution on an other stage? Or by doing build + analysis on one stage and test execute on an other (but in this case, how communicate the coverage result to the quality gate) ?

I’ve found some topics about it but I would like to know the current status :
SonarCloudAnalyze@1 when executed by different agent job to that of SonarCloudPrepare@1 in azure devops fails - SonarCloud - Sonar Community (sonarsource.com)

Combining code coverage from different scans - SonarQube - Sonar Community (sonarsource.com)

Thank you for your help,

Best regards

Hi,

The problem with splitting this is that unless all the paths match up between where the files sit during

  • the actual analysis
  • testing → file paths reported in the coverage reports
  • compilation → file paths reported in the build-wrapper-dump.json

then analysis isn’t going to work well. If the coverage reports are the odd man out, they simply won’t be imported and the rest should work. But if the build-wrapper report doesn’t match up with the file paths analysis sees, then you won’t get analysis.

Since you’re doing a post-processing on the coverage reports, it’s possible you could fix any path mismatches in that step tho.

In terms of speeding up analysis itself, you can make sure the analysis cache and parallel processing are used.

 
HTH,
Ann

Thank you for your answer,
It seems difficult and not really safe to try to split those steps so we won’t.

About speeding up analysis, we are using parallel processing and we are curretly testing the file system cache because the server option doesn’t perform enough for us.

Best regards,

Have a nice day