From 0378b27e26803b42b8025667bd1eebfbe8c463b0 Mon Sep 17 00:00:00 2001 From: xLexip Date: Sun, 27 Oct 2024 20:52:41 +0100 Subject: [PATCH] chore: Integrate SonarCloud --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++++ build.gradle.kts | 9 +++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ead86ff --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: SonarCloud +on: + push: + branches: + - main + - develop + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 23 + uses: actions/setup-java@v4 + with: + java-version: 23 + distribution: 'zulu' + - name: Cache SonarCloud 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: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./gradlew build sonar --info \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 952b930..1a7dbbc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,4 +3,13 @@ plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.compose) apply false + id("org.sonarqube") version "5.1.0.4882" +} + +sonar { + properties { + property("sonar.projectKey", "xLexip_Hecate") + property("sonar.organization", "xlexip") + property("sonar.host.url", "https://sonarcloud.io") + } } \ No newline at end of file