I have a dotnet core unit test within an Azure DevOps pipeline that usually takes 1-2 minutes.
When I enable Sonarcloud, the run takes up to 4 times as long as without (around 8-9 minutes).
We included the Sonarcloud steps in our Az-DevOps as described by Sonarcloud. Also I browsed through the community entries for e.g. Enabling SonarQube analysis cause dotnet build to be very slow but i cannot figure out what causes this time.
We are also running some integration tests which are also heavily impacted from the included sonarcloud processing.
The sonarloud tasks are:
- task: SonarCloudPrepare@1 inputs: SonarCloud: 'Sonar Cloud' organization: 'xxxx' scannerMode: 'MSBuild' projectKey: 'xxxx' projectName: 'xxxx' extraProperties: | sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/*.xml sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx - task: SonarCloudAnalyze@1 - task: SonarCloudPublish@1
The DotNetCoreCLI@2 task for the unit tests:
task: DotNetCoreCLI@2 displayName: Run dotnet test inputs: publishTestResults: true testRunTitle: 'Unit-tests' command: 'test' projects: | **/*Tests.csproj !**/*E2E.Tests.csproj arguments: '--configuration $(buildConfiguration) --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$(Agent.TempDirectory)/coverage/ /p:MergeWith=$(Agent.TempDirectory)/coverage/ --collect "Code coverage"'
Please find our logfiles attached logs.zip (1.1 MB) . A logfile for running the unit tests with and without sonarCloud. Build logfile
dotnet build ... /v:d /p:reportanalyzer=true for the project with and without sonarcloud. Hopefully it helps to figured out what caused this time issue.