Sonar scanner.

This commit is contained in:
aminecmi 2022-12-13 20:53:23 +01:00
parent 430fc8e8cb
commit 3593fbca78
3 changed files with 17 additions and 18 deletions

View File

@ -3,27 +3,34 @@ type: docker
name: test name: test
steps: steps:
- name: AnylyseBuildTest - name: BuildAndTest
image: mingc/android-build-box:latest image: mingc/android-build-box:latest
commands: commands:
- echo "---------------------------------------------------------" - echo "---------------------------------------------------------"
- echo "Configure gradle..." - 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 - 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 "---------------------------------------------------------"
- echo "Analysing..."
- ./gradlew koverMergedXmlReport && ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN
- echo "---------------------------------------------------------"
- echo "Building..." - echo "Building..."
- ./gradlew build -x test - ./gradlew build -x test
- echo "---------------------------------------------------------" - echo "---------------------------------------------------------"
- echo "Testing..." - echo "Testing..."
- echo "---------------------------------------------------------" - echo "---------------------------------------------------------"
- ./gradlew test - ./gradlew koverMergedXmlReport
environment: environment:
SONAR_HOST_URL: SONAR_HOST_URL:
from_secret: sonarScannerHostUrl from_secret: sonarScannerHostUrl
SONAR_LOGIN: SONAR_LOGIN:
from_secret: sonarScannerLogin 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: trigger:
event: event:
- push - push

View File

@ -11,13 +11,10 @@ plugins {
id("com.android.library").version("7.3.1").apply(false) id("com.android.library").version("7.3.1").apply(false)
kotlin("android").version("1.7.20").apply(false) kotlin("android").version("1.7.20").apply(false)
kotlin("multiplatform").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("com.mikepenz.aboutlibraries.plugin").version("10.5.1").apply(false)
id("org.jetbrains.kotlinx.kover") version "0.6.1" id("org.jetbrains.kotlinx.kover") version "0.6.1"
} }
apply(plugin = "org.sonarqube")
allprojects { allprojects {
repositories { repositories {
google() google()
@ -32,16 +29,6 @@ tasks.register("clean", Delete::class) {
delete(rootProject.buildDir) delete(rootProject.buildDir)
} }
sonarqube {
properties {
property("sonar.coverage.jacoco.xmlReportPaths", "${rootProject.buildDir}/reports/kover/merged/xml/report.xml")
}
}
project.tasks["sonarqube"].dependsOn "koverMergedXmlReport"
koverMerged { koverMerged {
enable() enable()
} }

5
sonar-project.properties Normal file
View File

@ -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/**