Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jacoco 도입 #50

Merged
merged 2 commits into from
Mar 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.4'
id "org.asciidoctor.jvm.convert" version "3.3.2"
id 'jacoco'
}

group = 'com'
Expand All @@ -12,7 +13,9 @@ java {
sourceCompatibility = '17'
}


jacoco {
toolVersion = "0.8.8"
}

configurations {
compileOnly {
Expand Down Expand Up @@ -78,8 +81,58 @@ dependencies {

tasks.named('test') {
useJUnitPlatform()
finalizedBy 'jacocoTestReport'
}

jacocoTestReport {
reports {
// html로 report 생성하기
// 빌드경로/jacoco/report.html 폴더 내부로 경로 설정
html.destination file("$buildDir/jacoco/report.html")
}

afterEvaluate {
classDirectories.setFrom(
files(classDirectories.files.collect {
fileTree(dir: it, excludes: [
'**/*Application*',
'**/*Exception*',
'**/dto/**',
'**/global/**',
'**/domain/healthCheck/**'
])
})
)
}

// finalizedBy 'jacocoTestCoverageVerification'

}

//jacocoTestCoverageVerification {
// violationRules {
// rule {
// enabled = true
// element = "CLASS"
//
// // 모든 클래스 각각 라인 커버리지 75% 만족시 빌드 성공
// limit {
// counter = 'LINE'
// value = 'COVEREDRATIO'
// minimum = 0.75
// }
// excludes = [
// '*.*Application',
// '*.*Exception',
// '*.dto.*',
// '*.infrastructure.*',
// '*.global.*',
// '*.domain.heamlthCheck.*'
// ]
// }
// }
//}

// gradlew 빌드시 에러 발생방지, 빌드시 -plain.jar 생기는 설정 끄기 for Github Actions
jar {
enabled = false
Expand Down
Loading