We were having issue of high build time when we on sonarcloud prepare step in Azure Devops pipeline, To overcome this we tried parallel jobs for Website and Website.Test .
Could you please suggest in which job we should have Prepare, Analysis and Publish task to get code analysis, code coverage
@Andrei_Epure - Are you creating two separate projects in SonarCloud for them? No Just two parallel jobs which can simultaneously build website and website.Test project and generate analysis
There are 2 scenario we tested
Scenario 1 - Job1 has SonarCloudPrepare and Analysis step, Job2 don’t have SonarCloudPrepare but have Analysis and publish report
Result - OverAll code coverage 0.0 and build fail because of SonarCloudPrepare didn’t run prior to analysis
Job1-Website
Job2-Website.Test
Job3- TDS
Scenario 2 - Job1 has SonarCloudPrepare and Analysis step, Job2 also have SonarCloudPrepare , Analysis and publish report
Result - OverAll code coverage correct 4.4 but Job2 almost takes 40+ min
Job1-Website
Job2-Website.Test
Job3- TDS
If you use the same project, the results from the second job that finishes will overwrite the results from the first one.
Analysis won’t work without Prepare. Prepare sets up the system for the analysis.
Also, please read this post which explains that the analysis happens during VSBuild and during Analysis as well.
In order to run, I imagine Website.Test needs to first build Website, right?
If the answer is yes, why not have a single job for Website.Test which builds (and analyzes) the Website and Website.Test, runs the tests, creates the coverage file and pushes it to SonarCloud?
Like this, at least the Website job will be faster and will return the results faster during the PR analysis.