From 92d0a13f9da770ac7ba3822a9885548ad9c2c48e Mon Sep 17 00:00:00 2001 From: adorableco Date: Wed, 4 Sep 2024 14:12:40 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20jacoco=20test=20Report=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=A0=9C?= =?UTF-8?q?=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 67 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index dd1b92f..1730870 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { id("jacoco") // for querydsl - kotlin("kapt") version "1.7.10" + kotlin("kapt") version "1.9.24" } subprojects { @@ -90,6 +90,7 @@ kotlin { tasks.withType { useJUnitPlatform() + finalizedBy("jacocoTestReport") } tasks.test { @@ -153,4 +154,68 @@ tasks.jacocoTestReport { html.outputLocation = file(project.layout.buildDirectory.dir("jacoco/index.html")) xml.outputLocation = file(project.layout.buildDirectory.dir("jacoco/index.xml")) } + + val qDomains = emptyList().toMutableList() + + for (c in 'A'..'Z') { + val qPattern = "**/*Q$c*" + qDomains.add("$qPattern*") + } + + val excludes = + listOf( + "**/service/*", + "**/dto/*", + "**/controller/*", + "**/external/*", + "**/repository/*", + "**/common/*", + "**/*PhoteApplication*", + ) + qDomains + + classDirectories.setFrom( + sourceSets["main"].output.asFileTree.matching { + exclude(excludes) + }, + ) + finalizedBy("jacocoTestCoverageVerification") +} + +tasks.jacocoTestCoverageVerification { + + violationRules { + rule { + element = "CLASS" + + limit { + counter = "BRANCH" + value = "COVEREDRATIO" + minimum = 0.00.toBigDecimal() + } + + limit { + counter = "METHOD" + value = "COVEREDRATIO" + minimum = 0.00.toBigDecimal() + } + + val qDomains = emptyList().toMutableList() + + for (c in 'A'..'Z') { + val qPattern = "**.*Q$c*" + qDomains.add("$qPattern*") + } + + excludes = + listOf( + "**.service.*", + "**.dto.*", + "**.controller.*", + "**.external.*", + "**.repository.*", + "**.common.*", + "**.*PhoteApplication*", + ) + qDomains + } + } } From 5b6e93256866feafe53622d993112c7e338262ef Mon Sep 17 00:00:00 2001 From: adorableco Date: Wed, 4 Sep 2024 14:21:00 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Fix:=20develop-ci.yml=20build=20=EC=BB=A4?= =?UTF-8?q?=EB=A7=A8=EB=93=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/develop-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/develop-ci.yml b/.github/workflows/develop-ci.yml index 989d973..6722207 100644 --- a/.github/workflows/develop-ci.yml +++ b/.github/workflows/develop-ci.yml @@ -34,7 +34,7 @@ jobs: run: chmod +x gradlew - name: Test with Gradle - run: ./gradlew clean build test jacocoTestReport + run: ./gradlew clean build test - name: Publish Unit Test Results uses: EnricoMi/publish-unit-test-result-action@v1