From 3593fbca787cf8ceea603d3e5c10eef8f85abc74 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Dec 2022 20:53:23 +0100 Subject: [PATCH] Sonar scanner. --- .drone.yml | 17 ++++++++++++----- build.gradle.kts | 13 ------------- sonar-project.properties | 5 +++++ 3 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 sonar-project.properties diff --git a/.drone.yml b/.drone.yml index 73377ae..409fb7e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,27 +3,34 @@ type: docker name: test steps: - - name: AnylyseBuildTest + - name: BuildAndTest image: mingc/android-build-box:latest commands: - echo "---------------------------------------------------------" - echo "Configure gradle..." - mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true\npushCache=false\nsystemProp.org.gradle.internal.http.connectionTimeout=180000\nsystemProp.org.gradle.internal.http.socketTimeout=180000" >> ~/.gradle/gradle.properties - echo "---------------------------------------------------------" - - echo "Analysing..." - - ./gradlew koverMergedXmlReport && ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN - - echo "---------------------------------------------------------" - echo "Building..." - ./gradlew build -x test - echo "---------------------------------------------------------" - echo "Testing..." - echo "---------------------------------------------------------" - - ./gradlew test + - ./gradlew koverMergedXmlReport environment: SONAR_HOST_URL: from_secret: sonarScannerHostUrl SONAR_LOGIN: from_secret: sonarScannerLogin + - name: Analyse + image: kytay/sonar-node-plugin + settings: + sonar_host: + from_secret: sonarScannerHostUrl + sonar_token: + from_secret: sonarScannerLogin + use_node_version: 16.18.1 + sonar_debug: true + sonar_project_settings: ./sonar-project.properties trigger: event: - push diff --git a/build.gradle.kts b/build.gradle.kts index 51cffac..ad05c95 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,13 +11,10 @@ plugins { id("com.android.library").version("7.3.1").apply(false) kotlin("android").version("1.7.20").apply(false) kotlin("multiplatform").version("1.7.20").apply(false) - id("org.sonarqube").version("3.4.0.2513") id("com.mikepenz.aboutlibraries.plugin").version("10.5.1").apply(false) id("org.jetbrains.kotlinx.kover") version "0.6.1" } -apply(plugin = "org.sonarqube") - allprojects { repositories { google() @@ -32,16 +29,6 @@ tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } - - -sonarqube { - properties { - property("sonar.coverage.jacoco.xmlReportPaths", "${rootProject.buildDir}/reports/kover/merged/xml/report.xml") - } -} - -project.tasks["sonarqube"].dependsOn "koverMergedXmlReport" - koverMerged { enable() } \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..5c3210f --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,5 @@ +sonar.projectKey=RFS2 +sonar.coverage.jacoco.xmlReportPaths=./build/reports/kover/merged/xml/report.xml +sonar.sourceEncoding=UTF-8 +sonar.sources=. +sonar.exclusions=./shared/src/iosArm64Main/**, ./shared/src/iosX64Main/**, ./docs/** \ No newline at end of file