Skip to content

Commit

Permalink
Integrate SonarQube code analysis
Browse files Browse the repository at this point in the history
Signed-off-by: Saeed Rezaee <[email protected]>
  • Loading branch information
SaeedRe committed Jan 17, 2024
1 parent 8490dc2 commit f3286ef
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/pipeline-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,33 @@ jobs:
uses: better0fdead/actions-setup-docker@better0fdead/increase-timeout

#Build without test on Windows or macOS (when not a PR)
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Gradle build
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: |
if [[ "$RUNNER_OS" == "Windows" || ( "$RUNNER_OS" == "macOS" && ${{ github.event_name }} != 'pull_request' ) ]]; then
./gradlew build -x test
else
./gradlew build
./gradlew build sonar --info
fi
shell: bash
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ plugins {
id 'java'
id 'com.github.jk1.dependency-license-report' version '1.16'
id("org.jetbrains.dokka") version "1.6.10"
id "org.sonarqube" version "4.4.1.3373"
}

repositories {
Expand All @@ -27,6 +28,13 @@ final def tdeps = gradle.settings.test_dependencies
final def app_version = '2.0.0'
ext.keep_test_container_alive = project.hasProperty('keep_test_container_alive') ? project.getProperty('keep_test_container_alive').toBoolean() : false

sonar {
properties {
property "sonar.projectKey", "Kynetics-hara-ddi-client"
property "sonar.projectName", "Kynetics"
}
}

allprojects {
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'maven-publish'
Expand Down

0 comments on commit f3286ef

Please sign in to comment.