Skip to content

Commit

Permalink
BUILD-6161 Add coverage parameter for SonarCloud scan
Browse files Browse the repository at this point in the history
  • Loading branch information
matemoln committed Sep 2, 2024
1 parent caeeb2e commit d1ffc3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .cirrus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build_task:
only_if: *ONLY_SONARSOURCE_QA
env:
ARTIFACTORY_DEPLOY_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token]
COVERAGE_FILE: coverage.xml
SM_API_KEY: VAULT[development/team/sonarlint/kv/data/codesigning/2023-2025 data.apikey]
SM_CERT_FP: VAULT[development/team/sonarlint/kv/data/codesigning/2023-2025 data.cert_fp]
SM_CERT: VAULT[development/team/sonarlint/kv/data/codesigning/2023-2025 data.cert]
Expand Down Expand Up @@ -76,7 +77,7 @@ build_task:
prepare_analysis_script: |
dotnet tool install --global dotnet-sonarscanner
dotnet tool install --global dotnet-coverage
dotnet sonarscanner begin -d:sonar.token=${SONAR_TOKEN} -d:sonar.host.url="${SONAR_URL}" -k:"${CIRRUS_REPO_NAME}" -o:"sonarsource"
dotnet sonarscanner begin -d:sonar.token=${SONAR_TOKEN} -d:sonar.host.url="${SONAR_URL}" -k:"${CIRRUS_REPO_NAME}" -o:"sonarsource" -d:sonar.cs.vscoveragexml.reportsPaths="${COVERAGE_FILE}" -d:sonar.scanner.scanAll=false
build_solution_script: |
msbuild.exe "${SOLUTION_PATH}" -p:VsVersion=17.0 -p:VsTargetVersion=2022 -p:SignArtifacts=${SHOULD_SIGN} -p:AssemblyOriginatorKeyFile="${SONARSOURCE_SNK_FILE}" -p:DeployExtension=false -p:Sha1="${CIRRUS_CHANGE_IN_REPO}" -p:BuildNumber="${CI_BUILD_NUMBER}" -p:Configuration=Release
sign_artifact_script: |
Expand Down Expand Up @@ -106,6 +107,8 @@ build_task:
jf rt bp ${CIRRUS_REPO_NAME} ${CI_BUILD_NUMBER}
tests_script: |
vstest.console.exe --EnableCodeCoverage --Logger:trx --ResultsDirectory:"TestResults" src/**/bin/**/Sonar*.*Tests.dll
collect_coverage_script: |
dotnet-coverage merge -o "${COVERAGE_FILE}" -f xml "**\*.coverage"
sonarcloud_analysis_script: |
dotnet sonarscanner end -d:sonar.token="${SONAR_TOKEN}"
on_failure:
Expand Down

0 comments on commit d1ffc3c

Please sign in to comment.