Skip to content

codemagic-ci-cd/android-sonarcloud-sample-project

Repository files navigation

Android Sonarcloud Sample Project

Configure environment variables

Set environment variables in your codemagic.yaml:

SONAR_TOKEN: Encrypted(...)
SONAR_PROJECT_KEY: Encrypted(...)
SONAR_ORG_KEY: Encrypted(...)

These values are available in your Sonarcloud account and can be encrypted in the Codemagic web app.

Add the Sonarcloud plugin in build.gradle

Add the sonarqube plugin to app/build.gradle

plugins {
    ...
    id "org.sonarqube" version "3.3"
    ...
}

Set Sonarcloud properties in build.gradle

Set the Sonarqube properties in app/build.gradle. Change the branch as required or also set that as an environment variable.

sonarqube {
    properties {
        property "sonar.host.url", "https://sonarcloud.io"
        property "sonar.branch", System.getenv("FCI_BRANCH")
        property "sonar.projectKey", System.getenv("SONAR_PROJECT_KEY")
        property "sonar.organization", System.getenv("SONAR_ORG_KEY")
        property "sonar.branch.name", System.getenv("FCI_BRANCH")
        property "sonar.branch.target", System.getenv("FCI_PULL_REQUEST_DEST")
        property "sonar.login", System.getenv("SONAR_TOKEN")
    }
}

Sonarcloud report

https://sonarcloud.io/dashboard?id=codemagic-ci-cd_android-sonarcloud-sample-project

Quality Gate Status

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages