Hi,
we are using Sonarcloud to test code for Android (Kotlin; gradle) and iOS(Swift). Pull Requests in both repos are decorated with the quality gate which is good!
However, we only have the result in the build table of bitbucket in the Android Repo.
I however can’t find a way to enable/disable this feature to have the result in the builds. Currently, we don’t want to have a blocking quality gate, so we want to remove it from the builds section. In the future however, I could see our teams enforcing more quality and this should be blocking so we want to enable this feature.
Also only in the Android Repo there are comments directly in the code which would be nice to have for iOS aswell
For our pipelines, we are using Azure Devops. These are the configs:
iOS:
pr:
autoCancel: true # cancel running PR builds when a new commit lands in the branch.
pool:
vmImage: macOS-12
variables:
- group: fastlane
- name: IS_CI
value: 1
steps:
- checkout: self
persistCredentials: true
- task: UseRubyVersion@0
inputs:
versionSpec: "~ 2.7"
addToPath: true
displayName: Use Ruby 2.7
- script: gem install bundler:2.3.17
displayName: Install desired bundler version
- script: |
bundle --version
ruby --version
displayName: Print bundler and ruby versions
- script: bundle install
displayName: Install Gems
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'Sonarcloud'
organization: 'org-repository'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'Org-app-ios'
cliProjectName: 'org-app-ios'
cliSources: '.'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions=**/*.bin
sonar.coverageReportPaths=./fastlane/test_output/sonarqube-generic-coverage.xml
- script: bundle exec fastlane ios test_app
displayName: Run app tests
- script: bundle exec fastlane ios code_cov
displayName: Run code coverage
- task: SonarCloudAnalyze@1
- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: fastlane/test_output
artifactName: test-results
Android:
trigger:
- develop # note This Pipeline is also triggered through webhooks on Pull Requests
pool:
vmImage: 'ubuntu-latest'
steps:
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'Sonarcloud'
organization: 'org-repository'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'Org-app-android'
cliProjectName: 'org-app-android'
cliSources: '.'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions=**/*.bin
sonar.coverage.jacoco.xmlReportPaths=**/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml
- task: Gradle@1
inputs:
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
publishJUnitResults: true
failTaskOnFailedTests: true
testResultsFiles: '**/TEST-*.xml'
tasks: 'jacocoTestReport'
- task: SonarCloudAnalyze@1
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
reportDirectory: "$(System.DefaultWorkingDirectory)/**/reports/jacoco/jacocoTestReport/html"
- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'