From 79b31a3c63b3370b0ab0cb446ee9ece7bc81fc39 Mon Sep 17 00:00:00 2001 From: WooYoungDoo Date: Sat, 9 Mar 2024 21:09:24 +0900 Subject: [PATCH 1/2] =?UTF-8?q?docs=20:=20jacoco=20=EB=8F=84=EC=9E=85=20#4?= =?UTF-8?q?9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b780bdb..8288fa9 100644 --- a/build.gradle +++ b/build.gradle @@ -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' @@ -12,7 +13,9 @@ java { sourceCompatibility = '17' } - +jacoco { + toolVersion = "0.8.8" +} configurations { compileOnly { @@ -78,6 +81,16 @@ dependencies { tasks.named('test') { useJUnitPlatform() + finalizedBy 'jacocoTestReport' +} + +jacocoTestReport { + reports { + // html로 report 생성하기 + // 빌드경로/jacoco/report.html 폴더 내부로 경로 설정 + html.destination file("$buildDir/jacoco/report.html") + } + } // gradlew 빌드시 에러 발생방지, 빌드시 -plain.jar 생기는 설정 끄기 for Github Actions From aa4f9f16f8f33d8dd4d2d3bf05195be950f8a7ae Mon Sep 17 00:00:00 2001 From: WooYoungDoo Date: Sun, 10 Mar 2024 21:09:19 +0900 Subject: [PATCH 2/2] =?UTF-8?q?docs=20:=20jacoco=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EA=B3=84=EC=82=B0=20=EC=A0=9C=EA=B1=B0=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?#49?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/build.gradle b/build.gradle index 8288fa9..6fc0f35 100644 --- a/build.gradle +++ b/build.gradle @@ -91,8 +91,48 @@ jacocoTestReport { 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