Integrate with SonarCloud

pull/4856/head
John Niang 2023-11-15 15:14:55 +08:00
parent b04496e4f3
commit 08898bf100
3 changed files with 33 additions and 0 deletions

View File

@ -33,6 +33,12 @@ jobs:
distribution: 'temurin'
cache: 'gradle'
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- uses: dorny/paths-filter@v2
id: changes
with:
@ -43,6 +49,11 @@ jobs:
run: ./gradlew check
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: Analyze code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --info
- name: Setup console environment
if: steps.changes.outputs.console == 'true'
uses: halo-sigs/actions/admin-env-setup@main

View File

@ -1,6 +1,7 @@
plugins {
id 'java-library'
id 'halo.publish'
id 'jacoco'
id "io.freefair.lombok" version "8.4"
}
@ -80,4 +81,12 @@ java {
tasks.named('test') {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
tasks.named('jacocoTestReport') {
reports {
xml.required = true
html.required = false
}
}

13
build.gradle Normal file
View File

@ -0,0 +1,13 @@
plugins {
id "org.sonarqube" version "4.4.1.3373"
}
group = "run.halo.app"
sonar {
properties {
property "sonar.projectKey", "halo-dev_halo"
property "sonar.organization", "halo-dev"
property "sonar.host.url", "https://sonarcloud.io"
}
}