Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate SonarQube #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .github/workflows/pipeline-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,36 @@ 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 }}
SONAR_CLOUD_ORGANIZATION: ${{ vars.SONAR_CLOUD_ORGANIZATION }}
SONAR_CLOUD_PROJECT_KEY: ${{ vars.SONAR_CLOUD_PROJECT_KEY }}
SONAR_CLOUD_PROJECT_NAME: ${{ vars.SONAR_CLOUD_PROJECT_NAME }}
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
16 changes: 16 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,12 +28,27 @@ 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

def sonarProjectKey = System.getenv("SONAR_CLOUD_PROJECT_KEY")
def sonarProjectName = System.getenv("SONAR_CLOUD_PROJECT_NAME")
def sonarProjectOrganization = System.getenv("SONAR_CLOUD_ORGANIZATION")

sonar {
properties {
property "sonar.projectKey", sonarProjectKey
property "sonar.projectName", sonarProjectName
property "sonar.organization", sonarProjectOrganization
property "sonar.sourceEncoding", "UTF-8"
property "sonar.host.url", "https://sonarcloud.io"
}
}

allprojects {
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'maven-publish'
apply from: "$rootDir/ktlint.gradle"
apply plugin: 'java'
apply plugin: "org.jetbrains.dokka"
apply plugin: "org.sonarqube"

repositories {
mavenCentral()
Expand Down
Loading