Skip to content

Commit 344cf43

Browse files
committed
Feat(#10): Jacoco 설정 추가
1 parent d8082af commit 344cf43

File tree

2 files changed

+68
-3
lines changed

2 files changed

+68
-3
lines changed

.github/workflows/application-image-server-test.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,14 @@ jobs:
2727
run: chmod +x gradlew
2828

2929
- name: 🧪 Spring Boot Test
30-
run: ./gradlew clean application:wypl-image:test
30+
run: ./gradlew clean application:wypl-image:test
31+
32+
- name: Add coverage to PR
33+
id: jacoco
34+
uses: madrapps/[email protected]
35+
with:
36+
title: 📄 Jacoco Coverage Report
37+
paths: ${{ github.workspace }}/**/wypl-image/reports/jacoco/test/jacocoTestReport.xml
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
min-coverage-overall: 80
40+
min-coverage-changed-files: 80

application/wypl-image/build.gradle

+57-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,62 @@ dependencies {
2626
testImplementation('org.mockito:mockito-core')
2727
}
2828

29-
// API Docs Start
29+
/* Jacoco Start */
30+
tasks.withType(JacocoReport).configureEach {
31+
reports {
32+
html.required.set(true)
33+
xml.required.set(true)
34+
html.outputLocation.set(file("reports/jacoco/index.xml"))
35+
}
36+
37+
classDirectories.setFrom(
38+
files(classDirectories.files.collect {
39+
fileTree(it) {
40+
exclude(
41+
"**/*Application*",
42+
"**/*Configuration*",
43+
"**/*Request*",
44+
"**/*Response*",
45+
"**/common/**",
46+
"**/config/**",
47+
"**/data/**",
48+
"**/exception/**",
49+
"**/properties/**"
50+
)
51+
}
52+
})
53+
)
54+
}
55+
56+
tasks.jacocoTestCoverageVerification {
57+
violationRules {
58+
rule {
59+
enabled = true
60+
element = 'CLASS'
61+
62+
limit {
63+
counter = 'LINE'
64+
value = 'COVEREDRATIO'
65+
minimum = 0.80D
66+
}
67+
68+
excludes = [
69+
"**/*Application*",
70+
"**/*Configuration*",
71+
"**/*Request*",
72+
"**/*Response*",
73+
"**/common/**",
74+
"**/config/**",
75+
"**/data/**",
76+
"**/exception/**",
77+
"**/properties/**"
78+
]
79+
}
80+
}
81+
}
82+
/* Jacoco End */
83+
84+
/* API Docs Start */
3085
openapi3 {
3186
setServer("http://127.0.0.1:8080")
3287
title = "What's Your Plan! Image Server API Docs"
@@ -42,4 +97,4 @@ tasks.register("copyOasToSwagger", Copy) {
4297
from("build/api-spec/openapi3.yaml")
4398
into("src/main/resources/static/swagger-ui/")
4499
}
45-
// API Docs End
100+
/* API Docs End */

0 commit comments

Comments
 (0)