Add SonarQube scan workflow
All checks were successful
SonarQube Scan / SonarQube Trigger (push) Successful in 18m19s
All checks were successful
SonarQube Scan / SonarQube Trigger (push) Successful in 18m19s
This commit introduces a Gitea workflow to trigger SonarQube scans on pushes to the `main` branch and on pull requests.
This commit is contained in:
42
.gitea/workflows/sonar.yaml
Normal file
42
.gitea/workflows/sonar.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
name: SonarQube Scan
|
||||
jobs:
|
||||
sonarqube:
|
||||
name: SonarQube Trigger
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checking out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Disabling shallow clone is recommended for improving relevancy of reporting
|
||||
fetch-depth: 0
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 21
|
||||
distribution: 'temurin' # Alternative distribution options are available.
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
- name: Cache SonarQube packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.sonar/cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
||||
restore-keys: ${{ runner.os }}-gradle
|
||||
- name: SonarQube Scan
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
||||
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
||||
run: ./gradlew build sonar --info --build-cache
|
||||
@@ -6,6 +6,7 @@ plugins {
|
||||
// this is necessary to avoid the plugins to be loaded multiple times
|
||||
// in each subproject's classloader
|
||||
alias(libs.plugins.versions)
|
||||
alias(libs.plugins.sonarqube)
|
||||
alias(libs.plugins.android.application) apply false
|
||||
alias(libs.plugins.android.library) apply false
|
||||
alias(libs.plugins.compose) apply false
|
||||
@@ -15,6 +16,13 @@ plugins {
|
||||
alias(libs.plugins.jetbrains.kotlin.android) apply false
|
||||
}
|
||||
|
||||
sonar {
|
||||
properties {
|
||||
property("sonar.projectKey", "YAEP")
|
||||
property("sonar.projectName", "YAEP")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinJvmCompile>().configureEach {
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.fromTarget(libs.versions.jdk.get()))
|
||||
|
||||
@@ -4,7 +4,7 @@ app-version-name = "1.0.0"
|
||||
agp = "8.11.1"
|
||||
jdk = "21"
|
||||
android-compileSdk = "36"
|
||||
android-minSdk = "24"
|
||||
android-minSdk = "26"
|
||||
android-targetSdk = "36"
|
||||
androidx-activityCompose = "1.10.1"
|
||||
androidx-compose = "1.8.3"
|
||||
@@ -35,5 +35,6 @@ android-library = { id = "com.android.library", version.ref = "agp" }
|
||||
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
sonarqube = { id = "org.sonarqube", version = "6.2.0.5505" }
|
||||
compose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
|
||||
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
|
||||
Reference in New Issue
Block a user