File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,19 +32,36 @@ jobs:
3232 echo "${{ secrets.ENV_DEV }}" > .env.test
3333 shell : bash
3434
35+ - name : Cache SonarCloud packages
36+ uses : actions/cache@v4
37+ with :
38+ path : ~/.sonar/cache
39+ key : ${{ runner.os }}-sonar
40+ restore-keys : ${{ runner.os }}-sonar
41+
42+ - name : Cache Gradle packages
43+ uses : actions/cache@v4
44+ with :
45+ path : ~/.gradle/caches
46+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
47+ restore-keys : ${{ runner.os }}-gradle
48+
3549 - name : touch dev data.sql
3650 run : |
3751 touch src/main/resources/sql/data.sql
3852 echo "${{ secrets.DATA_SQL }}" > src/main/resources/sql/data.sql
3953 shell : bash
54+
4055 - name : touch test data.sql
4156 run : |
4257 touch src/test/resources/sql/data.sql
4358 echo "${{ secrets.TEST_DATA_SQL }}" > src/test/resources/sql/data.sql
4459 shell : bash
4560
4661 - name : Build and analyze
47- run : ./gradlew build
62+ env :
63+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
64+ run : ./gradlew build sonar --info
4865
4966 - name : Upload Gradle Report
5067 uses : actions/upload-artifact@v4
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ plugins {
22 id ' java'
33 id ' org.springframework.boot' version ' 3.4.3'
44 id ' io.spring.dependency-management' version ' 1.1.7'
5+ id " org.sonarqube" version " 6.2.0.5505"
6+ id ' jacoco'
57}
68
79group = ' org.Runimo'
@@ -60,6 +62,52 @@ dependencies {
6062
6163}
6264
65+ jacoco {
66+ toolVersion = " 0.8.12"
67+ }
68+
69+ jacocoTestReport {
70+ dependsOn test
71+ reports {
72+ xml. required = true
73+ html. required = true
74+ csv. required = false
75+ }
76+ finalizedBy jacocoTestCoverageVerification
77+ }
78+
79+ jacocoTestCoverageVerification {
80+ dependsOn jacocoTestReport
81+ violationRules {
82+ rule {
83+ limit {
84+ minimum = 0.70 // 70% 커버리지 요구
85+ }
86+ }
87+ rule {
88+ enabled = false
89+ element = ' CLASS'
90+ includes = [' org.Runimo.*' ]
91+ limit {
92+ counter = ' LINE'
93+ value = ' TOTALCOUNT'
94+ maximum = 200
95+ }
96+ }
97+ }
98+ }
99+
100+ sonar {
101+ properties {
102+ property " sonar.projectKey" , " Run-Us_Runimo"
103+ property " sonar.organization" , " runimo-backend-server"
104+ property " sonar.host.url" , " https://sonarcloud.io"
105+ }
106+ }
107+
63108tasks. named(' test' ) {
64109 useJUnitPlatform()
110+ finalizedBy jacocoTestReport
65111}
112+
113+ tasks. sonarqube. dependsOn jacocoTestReport
You can’t perform that action at this time.
0 commit comments