From b8b93d1ec1d85b86551f74820bd0cda345ef3f32 Mon Sep 17 00:00:00 2001 From: JunHyeongChoi Date: Thu, 14 Nov 2024 22:22:25 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BB=A4=EB=B2=84=EB=A6=AC=EC=A7=80=20=EC=B8=A1=EC=A0=95=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr_weekly_ci.yml | 16 ++++++++++++++++ build.gradle | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/.github/workflows/pr_weekly_ci.yml b/.github/workflows/pr_weekly_ci.yml index f54701f..8714ecc 100644 --- a/.github/workflows/pr_weekly_ci.yml +++ b/.github/workflows/pr_weekly_ci.yml @@ -67,3 +67,19 @@ jobs: with: report_paths: '**/build/test-results/test/TEST-*.xml' token: ${{ github.token }} + + - name: JaCoCo 테스트 커버리지 리포트 업로드 + uses: actions/upload-artifact@v3 + if: always() + with: + name: jacoco-report + path: '**/build/reports/jacoco/' + + - name: JaCoCo 테스트 커버리지 결과를 PR에 코멘트로 등록 + uses: madrapps/jacoco-report@v1.6.1 + with: + paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml + token: ${{ github.token }} + min-coverage-overall: 80 + min-coverage-changed-files: 80 + title: '📊 테스트 커버리지 리포트' diff --git a/build.gradle b/build.gradle index 98243d9..4e12aab 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java' + id 'jacoco' id 'org.springframework.boot' version '3.3.3' id 'io.spring.dependency-management' version '1.1.6' } @@ -51,3 +52,14 @@ dependencies { tasks.named('test') { useJUnitPlatform() } + +jacocoTestReport { + reports { + xml.required = true + html.required = true + } +} + +test { + finalizedBy jacocoTestReport +} From c10dee6263432f635dbbb47a751723cef2c32ab8 Mon Sep 17 00:00:00 2001 From: JunHyeongChoi Date: Thu, 14 Nov 2024 22:26:03 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=EB=93=A4=EC=97=AC=EC=93=B0=EA=B8=B0?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr_weekly_ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr_weekly_ci.yml b/.github/workflows/pr_weekly_ci.yml index 8714ecc..a2fc914 100644 --- a/.github/workflows/pr_weekly_ci.yml +++ b/.github/workflows/pr_weekly_ci.yml @@ -53,7 +53,7 @@ jobs: - name: 빌드 테스트 수행 run: | chmod +x ./gradlew - ./gradlew clean build --build-cache --stacktrace + ./gradlew clean build jacocoTestReport --build-cache --stacktrace - name: 테스트 수행 결과 보고 uses: EnricoMi/publish-unit-test-result-action@v2 @@ -69,17 +69,15 @@ jobs: token: ${{ github.token }} - name: JaCoCo 테스트 커버리지 리포트 업로드 - uses: actions/upload-artifact@v3 - if: always() - with: - name: jacoco-report - path: '**/build/reports/jacoco/' + uses: actions/upload-artifact@v3 + if: always() + with: + name: jacoco-report + path: '**/build/reports/jacoco/' - name: JaCoCo 테스트 커버리지 결과를 PR에 코멘트로 등록 uses: madrapps/jacoco-report@v1.6.1 with: paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml token: ${{ github.token }} - min-coverage-overall: 80 - min-coverage-changed-files: 80 title: '📊 테스트 커버리지 리포트' From e0074dde72e6521869beeb7fc7f293b0e40733e3 Mon Sep 17 00:00:00 2001 From: JunHyeongChoi Date: Thu, 14 Nov 2024 22:30:46 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BB=A4=EB=B2=84=EB=A6=AC=EC=A7=80=20=EC=B5=9C=EC=86=8C=20?= =?UTF-8?q?=EA=B8=B0=EC=A4=80=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr_weekly_ci.yml | 2 ++ build.gradle | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/.github/workflows/pr_weekly_ci.yml b/.github/workflows/pr_weekly_ci.yml index a2fc914..372f0ca 100644 --- a/.github/workflows/pr_weekly_ci.yml +++ b/.github/workflows/pr_weekly_ci.yml @@ -80,4 +80,6 @@ jobs: with: paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml token: ${{ github.token }} + min-coverage-overall: 70 + min-coverage-changed-files: 70 title: '📊 테스트 커버리지 리포트' diff --git a/build.gradle b/build.gradle index 4e12aab..8c803bb 100644 --- a/build.gradle +++ b/build.gradle @@ -54,12 +54,38 @@ tasks.named('test') { } jacocoTestReport { + dependsOn test // 테스트 실행 후 리포트 생성을 보장 + reports { xml.required = true html.required = true } + + afterEvaluate { + classDirectories.setFrom(files(classDirectories.files.collect { + fileTree(dir: it, exclude: [ + '**/dto/**', + '**/entity/**', + '**/config/**', + '**/exception/**', + '**/*Application.class' + ]) + })) + } } test { + useJUnitPlatform() finalizedBy jacocoTestReport } + +// 테스트 커버리지 최소 기준 설정 +jacocoTestCoverageVerification { + violationRules { + rule { + limit { + minimum = 0.70 + } + } + } +} From 234bc8f5447607aac5824ea1db8d0a1098ff546f Mon Sep 17 00:00:00 2001 From: JunHyeongChoi Date: Thu, 14 Nov 2024 22:34:21 +0900 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=EC=B8=A1=EC=A0=95=20=EC=A0=9C?= =?UTF-8?q?=EC=99=B8=20=EB=8C=80=EC=83=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 8c803bb..ff625e8 100644 --- a/build.gradle +++ b/build.gradle @@ -64,9 +64,10 @@ jacocoTestReport { afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { fileTree(dir: it, exclude: [ - '**/dto/**', - '**/entity/**', + '**/constant/**', '**/config/**', + '**/dto/**', + '**/security/**', '**/exception/**', '**/*Application.class' ])