From 14099772c8ec1aaed2d955f4ba1f5181d1a53a28 Mon Sep 17 00:00:00 2001 From: hs12 Date: Tue, 20 Aug 2024 20:32:24 +0900 Subject: [PATCH 1/8] =?UTF-8?q?[chore]=20:=20jacoco=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80=20-=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EA=B2=B0=EA=B3=BC=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20-=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EA=B7=9C=EC=B9=99=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c678b6c4..47418078 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' version '3.2.8' id 'io.spring.dependency-management' version '1.1.6' + id 'jacoco' } group = 'com.dnd' @@ -23,6 +24,67 @@ repositories { mavenCentral() } +test { + useJUnitPlatform() + finalizedBy jacocoTestReport +} + +jacoco { + toolVersion = "0.8.12" + reportsDirectory = layout.buildDirectory.dir('jacocoReport') +} + +def QDomains = [] + +for (qPattern in '**/QA'..'**/QZ') { + QDomains.add(qPattern + '*') +} + +jacocoTestReport { + dependsOn test + + classDirectories.setFrom(files(classDirectories.files.collect { + fileTree(dir: it, excludes: [ + '**/*Application*', + '**/exception/**', + '**/config/**', + '**/dto/**', + '**/s3/**' + ] + QDomains) + })) + + reports { + html.required.set(true) + xml.required.set(true) + csv.required.set(true) + } +} + +jacocoTestCoverageVerification { + violationRules { + rule { + enabled = true + element = 'CLASS' + + limit { + counter = 'LINE' + value = 'COVERERDRATIO' + minimum = 0.75 + } + } + + rule { + excludes = [ + '**/*Application*', + '**/exception/**', + '**/config/**', + '**/dto/**', + '**/s3/**' + ] + QDomains + } + } +} + dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' @@ -66,7 +128,7 @@ dependencies { // mail implementation 'org.springframework.boot:spring-boot-starter-mail' - + //swagger implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0' From 99be6c2fac2e9aed76e62ce675d89003c0201982 Mon Sep 17 00:00:00 2001 From: hs12 Date: Tue, 20 Aug 2024 20:54:32 +0900 Subject: [PATCH 2/8] =?UTF-8?q?[chore]=20:=20=EC=BB=A4=EB=B2=84=EB=A6=AC?= =?UTF-8?q?=EC=A7=80=20=ED=95=98=ED=95=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 47418078..6f6f7da4 100644 --- a/build.gradle +++ b/build.gradle @@ -69,7 +69,7 @@ jacocoTestCoverageVerification { limit { counter = 'LINE' value = 'COVERERDRATIO' - minimum = 0.75 + minimum = 0.7 } } From 8cb2f80891df8332f45a855a8779de170e517602 Mon Sep 17 00:00:00 2001 From: hs12 Date: Tue, 20 Aug 2024 20:54:58 +0900 Subject: [PATCH 3/8] =?UTF-8?q?[chore]=20:=20Jacoco=20=EA=B2=B0=EA=B3=BC?= =?UTF-8?q?=20=EC=B6=9C=EB=A0=A5=ED=95=98=EB=8A=94=20CI=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97f565d4..1cc937a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,26 +19,22 @@ jobs: - name: Check the timezone run: date - # 자바 버전 설정 - - name: Set up JDK 17 + - name: 자바 버전 17 설정 uses: actions/setup-java@v3 with: java-version: '17' distribution: 'temurin' - # test 경로 application.yml 파일 생성 - - name: Generate application.yml + - name: test 경로 application.yml 파일 생성 run: | mkdir -p ./src/test/resources echo "${{ secrets.TEST_APPLICATION_YML }}" > ./src/test/resources/application.yml - # gradle 권한 부여 - - name: Grant execute permission for gradlew + - name: gradle 권한 부여 run: chmod +x ./gradlew shell: bash - # 빌드 시 캐시 적용 - - name: Gradle Caching + - name: 빌드 시 캐시 적용 uses: actions/cache@v3 with: path: | @@ -48,19 +44,27 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - # 빌드 - - name: Build with Gradle + - name: 빌드 run: ./gradlew build - # 테스트 결과 PR 코멘트에 등록 - - name: Register the test results as PR comments + - name: Jacoco 테스트 결과 출력 + id: jacoco + uses: madrapps/jacoco-report@v1.6.1 + with: + title: Code Coverage + paths: ${{ github.workspace }}/**/build/reports/jacocoReport/test/jacocoTestReport.xml + token: ${{ secrets.GITHUB_TOKEN }} + min-coverage-overall: 60 + min-coverage-changed-files: 60 + update-comment: true + + - name: 테스트 결과 PR 코멘트에 등록 uses: EnricoMi/publish-unit-test-result-action@v2 if: always() with: files: '**/build/test-results/test/TEST-*.xml' - # 테스트 실패시 코드 라인에 대한 체크 추가 - - name: If test fail, add check comment on failed code line + - name: 테스트 실패시 코드 라인에 대한 체크 추가 uses: mikepenz/action-junit-report@v3 if: always() with: From 4d5eadb2e33ccc7eb0bba1d027d3229ed2d00b52 Mon Sep 17 00:00:00 2001 From: hs12 Date: Wed, 21 Aug 2024 13:08:09 +0900 Subject: [PATCH 4/8] =?UTF-8?q?[fix]=20:=20ci=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cc937a0..4350ca1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: uses: madrapps/jacoco-report@v1.6.1 with: title: Code Coverage - paths: ${{ github.workspace }}/**/build/reports/jacocoReport/test/jacocoTestReport.xml + paths: ${{ github.workspace }}/build/jacocoReport/test/jacocoTestReport.xml token: ${{ secrets.GITHUB_TOKEN }} min-coverage-overall: 60 min-coverage-changed-files: 60 From ccedf13e3139b11447a0ac3ce7df03150eb01913 Mon Sep 17 00:00:00 2001 From: hs12 Date: Wed, 21 Aug 2024 13:17:15 +0900 Subject: [PATCH 5/8] =?UTF-8?q?[chore]=20:=20ci=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A6=BD=ED=8A=B8=20step=20name=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4350ca1f..66ea368b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - name: 빌드 run: ./gradlew build - - name: Jacoco 테스트 결과 출력 + - name: Jacoco Test Coverage Report 코멘트에 등록 id: jacoco uses: madrapps/jacoco-report@v1.6.1 with: From e690fefb9fcecad05d4e74696765aa3330bc8373 Mon Sep 17 00:00:00 2001 From: hs12 Date: Wed, 21 Aug 2024 13:24:20 +0900 Subject: [PATCH 6/8] =?UTF-8?q?[chore]=20:=20=EB=B9=8C=EB=93=9C,=20ci=20?= =?UTF-8?q?=EC=8B=9C=20=EC=BB=A4=EB=B2=84=EB=A6=AC=EC=A7=80=20=ED=95=98?= =?UTF-8?q?=ED=95=9C=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 ++-- build.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66ea368b..12029c39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,8 +54,8 @@ jobs: title: Code Coverage paths: ${{ github.workspace }}/build/jacocoReport/test/jacocoTestReport.xml token: ${{ secrets.GITHUB_TOKEN }} - min-coverage-overall: 60 - min-coverage-changed-files: 60 + min-coverage-overall: 65 + min-coverage-changed-files: 65 update-comment: true - name: 테스트 결과 PR 코멘트에 등록 diff --git a/build.gradle b/build.gradle index 6f6f7da4..21223e0b 100644 --- a/build.gradle +++ b/build.gradle @@ -69,7 +69,7 @@ jacocoTestCoverageVerification { limit { counter = 'LINE' value = 'COVERERDRATIO' - minimum = 0.7 + minimum = 0.65 } } From eb900a3ffca534eeb6df1bbf9612d94c44133ad5 Mon Sep 17 00:00:00 2001 From: hs12 Date: Wed, 21 Aug 2024 14:48:30 +0900 Subject: [PATCH 7/8] =?UTF-8?q?[chore]=20:=20security=20=EA=B2=80=EC=A6=9D?= =?UTF-8?q?=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 21223e0b..d1295651 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,8 @@ jacocoTestReport { '**/exception/**', '**/config/**', '**/dto/**', - '**/s3/**' + '**/s3/**', + '**/security/**' ] + QDomains) })) @@ -79,7 +80,8 @@ jacocoTestCoverageVerification { '**/exception/**', '**/config/**', '**/dto/**', - '**/s3/**' + '**/s3/**', + '**/security/**' ] + QDomains } } From 1d23f54c1a66300ae4add23c0927fde9504d3e93 Mon Sep 17 00:00:00 2001 From: hs12 Date: Wed, 21 Aug 2024 14:53:19 +0900 Subject: [PATCH 8/8] =?UTF-8?q?[chore]=20:=20lombok=20test=20coverage=20?= =?UTF-8?q?=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lombok.config | 1 + 1 file changed, 1 insertion(+) create mode 100644 lombok.config diff --git a/lombok.config b/lombok.config new file mode 100644 index 00000000..8f7e8aa1 --- /dev/null +++ b/lombok.config @@ -0,0 +1 @@ +lombok.addLombokGeneratedAnnotation = true \ No newline at end of file