Skip to content

Commit

Permalink
ci: SonarCloud CI 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jbw9964 committed Nov 15, 2024
1 parent d3dbc04 commit af0fb0b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/ci-with-gradle-and-sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,18 @@ jobs:
require_tests: true


# 이후 추가 예정
# # Sonar Cloud 패키지 캐싱
# - name: Cache SonarCloud packages
# uses: actions/cache@v4.1.2
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar
#
#
# # Sonar 로 코드 분석 & SonarCloud 로 결과 upload
# - name: Analyze via Sonar
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: ./gradlew sonar --info
# Sonar Cloud 패키지 캐싱
- name: Cache SonarCloud packages
uses: actions/cache@v4.1.2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar


# Sonar 로 코드 분석 & SonarCloud 로 결과 upload
- name: Analyze via Sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --info
19 changes: 19 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {

// 테코 커버리지 분석
id 'jacoco'
id "org.sonarqube" version "5.1.0.4882"
}

group = 'com'
Expand Down Expand Up @@ -72,3 +73,21 @@ jacocoTestReport {
}))
}
}

// gradlew 에 sonar task 구성
sonar {
properties {
property "sonar.projectKey", "prgrms-web-devcourse-final-project_WEB1_1_ZeroOne_BE"
property "sonar.organization", "prgrms-web-devcourse-final-project"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.language", "java"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.sources", "src/main/java"
property "sonar.tests", "src/test/java"

// jacocoTestReport 수행 시 test report xml 파일 위치 (중요)
property 'sonar.coverage.jacoco.xmlReportPaths', 'build/reports/jacoco/test/jacocoTestReport.xml'
property "sonar.test.inclusions", "**/*Test.java"
property "sonar.coverage.exclusions", "**/dto/**, **/event/**, **/*InitData*, **/*Application*, **/exception/**, **/service/alarm/**, **/aop/**, **/config/**, **/MemberRole*"
}
}

0 comments on commit af0fb0b

Please sign in to comment.