Skip to content

Commit

Permalink
chore: sonarcloud setting (#38)
Browse files Browse the repository at this point in the history
* chore: lifeCycle remove 1

* chore: Sonar test
  • Loading branch information
char-yb committed Dec 5, 2023
1 parent b4442d7 commit a7ed2a4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/develop_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
java-version: [ 17 ]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
Expand All @@ -22,12 +22,21 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

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

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: check
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

- name: LifeCycle check
run: |
./gradlew check
- name: SonarCloud scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --info --stacktrace
24 changes: 20 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'io.spring.dependency-management' version '1.1.3'
id 'com.diffplug.spotless' version '6.11.0'
id 'jacoco'
id 'org.sonarqube' version '4.4.1.3373'
}

group = 'com.depromeet'
Expand Down Expand Up @@ -44,10 +45,6 @@ tasks.named('test') {
finalizedBy 'jacocoTestReport'
}

jacoco {
toolVersion = "0.8.8"
}

def jacocoDir = layout.buildDirectory.dir("reports/")

def QDomains = []
Expand All @@ -68,6 +65,25 @@ def jacocoExcludePatterns = [
"**/*Resolver*"
]

sonar {
properties {
property "sonar.projectKey", "depromeet_10mm-server"
property "sonar.organization", "depromeet-1"
property "sonar.host.url", "https://sonarcloud.io"
property 'sonar.sources', 'src'
property 'sonar.language', 'java'
property 'sonar.sourceEncoding', 'UTF-8'
property 'sonar.test.exclusions', jacocoExcludePatterns.toString()
property 'sonar.test.inclusions', '**/*Test.java'
property 'sonar.java.coveragePlugin', 'jacoco'
property 'sonar.coverage.jacoco.xmlReportPaths', jacocoDir.get().file("jacoco/index.xml").asFile
}
}

jacoco {
toolVersion = "0.8.8"
}

jacocoTestReport {
dependsOn test
reports {
Expand Down

0 comments on commit a7ed2a4

Please sign in to comment.