Skip to content

Commit

Permalink
Enable SonarQube
Browse files Browse the repository at this point in the history
  • Loading branch information
JPercival committed Oct 2, 2024
1 parent 9314a20 commit 5652fa8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,23 @@ jobs:
with:
distribution: 'temurin'
java-version: '21'
cache: gradle
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run Gradle Build
working-directory: ./Src/java
run: ./gradlew check publish
run: ./gradlew check publish sonar
env:
OSSRH_USERNAME: ${{ vars.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ jobs:
distribution: 'temurin'
java-version: '21'
cache: gradle
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run Gradle Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
working-directory: ./Src/java
run: ./gradlew check -x spotlessCheck
run: ./gradlew check sonar -x spotlessCheck
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: (success() || failure()) && matrix.os == 'ubuntu-latest'
Expand Down
9 changes: 9 additions & 0 deletions Src/java/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
plugins {
id 'idea'
id 'eclipse'
id "org.sonarqube" version "4.4.1.3373"
}

sonar {
properties {
property "sonar.projectKey", "cqframework_clinical_quality_language"
property "sonar.organization", "cqframework"
property "sonar.host.url", "https://sonarcloud.io"
}
}

idea {
Expand Down

0 comments on commit 5652fa8

Please sign in to comment.