From e10d0b2f63a83686b5072347268ad80adeae7b68 Mon Sep 17 00:00:00 2001 From: kimdohyung Date: Tue, 9 Jul 2024 15:06:42 +0900 Subject: [PATCH] =?UTF-8?q?deploy:=20jacoco=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EC=BB=A4=EB=B2=84=EB=A6=AC=EC=A7=80=20=EB=B6=84=EC=84=9D=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20(#126)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr_text.yml | 52 +++++++++++++++++++++++++++++++++++ build.gradle | 19 +++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/pr_text.yml diff --git a/.github/workflows/pr_text.yml b/.github/workflows/pr_text.yml new file mode 100644 index 0000000..161cb05 --- /dev/null +++ b/.github/workflows/pr_text.yml @@ -0,0 +1,52 @@ +name: PR Test + +on: + pull_request: + branches: [ develop ] + +permissions: write-all + +jobs: + test: + # 실행 환경 + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + + # JDK 17 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + # Gradle Caching + - name: Gradle Caching + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + # ./gradlew 권한 설정 + - name: ./gradlew 권한 설정 + run: chmod +x ./gradlew + + # Gradle 테스트 수행 + - name: ./gradlew 테스트 + run: ./gradlew --info test + + # Jacoco Test Coverage Report + - name: Test Coverage Report + id: jacoco + uses: madrapps/jacoco-report@v1.6 + with: + title: Test Coverage Report + paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml + token: ${{ secrets.GITHUB_TOKEN }} + min-coverage-overall: 70 + min-coverage-changed-files: 70 \ No newline at end of file diff --git a/build.gradle b/build.gradle index 6abfae4..8d99fb8 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id 'org.springframework.boot' version '3.1.9' id 'io.spring.dependency-management' version '1.1.4' id "org.asciidoctor.jvm.convert" version "3.3.2" + id 'jacoco' } group = 'com' @@ -131,3 +132,21 @@ bootJar { } } // ------------------- + +// Jacoco 설정 ------------------- +test { + finalizedBy jacocoTestReport + useJUnitPlatform() +} + +jacoco { + toolVersion = "0.8.8" +} + +jacocoTestReport { + dependsOn test + reports { + xml.required.set(true) + } +} +// ------------------- \ No newline at end of file