From 16420e95ca4b60d70cee6fb36a828aa17e609eb1 Mon Sep 17 00:00:00 2001 From: One-armed-boy Date: Mon, 4 Mar 2024 17:35:26 +0900 Subject: [PATCH 1/3] =?UTF-8?q?build.gradle=20=EB=82=B4=20Jacoco=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/build.gradle b/build.gradle index 60b9b422..8085a02f 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' version '3.2.3' id 'io.spring.dependency-management' version '1.1.4' + id 'jacoco' } group = 'com.tiketeer' @@ -11,6 +12,11 @@ java { sourceCompatibility = '21' } +jacoco { + toolVersion = "0.8.9" +} + + configurations { compileOnly { extendsFrom annotationProcessor @@ -36,3 +42,17 @@ dependencies { tasks.named('test') { useJUnitPlatform() } + +tasks.named('test') { + useJUnitPlatform() + finalizedBy jacocoTestReport +} + +jacocoTestReport { + dependsOn test // tests are required to run before generating the report + reports { + xml.required = true + html.required = false + csv.required = false + } +} \ No newline at end of file From 23b14315e1cd93e91b72d5da63bee91efc891abc Mon Sep 17 00:00:00 2001 From: One-armed-boy Date: Mon, 4 Mar 2024 17:38:48 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Github=20Action=20=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=B6=94=EA=B0=80=20-=20gradle?= =?UTF-8?q?=20=EB=B9=8C=EB=93=9C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20-=20gradl?= =?UTF-8?q?ew=20=EC=9C=A0=EB=8B=9B=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20-=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BB=A4=EB=B2=84=EB=A6=AC?= =?UTF-8?q?=EC=A7=80=20=EC=BD=94=EB=A9=98=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/pr-check.yml | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/pr-check.yml diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 00000000..fd659064 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,49 @@ +name: Check PR + +on: + pull_request + +permissions: + checks: write + pull-requests: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: 21 + distribution: 'temurin' + + - name: Cache Gradle + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Check Build + run: ./gradlew clean build + + - name: Run test + run: ./gradlew test + + - name: Add coverage to PR + id: jacoco + uses: madrapps/jacoco-report@v1.6.1 + with: + paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml + token: ${{ secrets.GITHUB_TOKEN }} + min-coverage-overall: 40 + min-coverage-changed-files: 60 + update-comment: true + title: Test Coverage + pass-emoji: ':green_circle:' + fail-emoji: ':red_circle:' From 9287dd456b8b8bfb42de09d5d15b271677c2b350 Mon Sep 17 00:00:00 2001 From: One-armed-boy Date: Mon, 4 Mar 2024 20:58:03 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81=20-?= =?UTF-8?q?=20actions/setup-java=20=EB=B2=84=EC=A0=84=EC=97=85=20(3=20->?= =?UTF-8?q?=204)=20-=20actions/setup-java=EC=9D=98=20cache=20=EC=98=B5?= =?UTF-8?q?=EC=85=98=EC=9D=84=20=ED=86=B5=ED=95=9C=20=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=8A=A4=ED=85=9D=20=EA=B0=84?= =?UTF-8?q?=EB=9E=B5=ED=99=94=20-=20Check=20Build=20=EC=8A=A4=ED=85=9D=20?= =?UTF-8?q?=EC=8B=9C=20=EC=88=9C=EC=88=98=ED=95=98=EA=B2=8C=20=EB=B9=8C?= =?UTF-8?q?=EB=93=9C=EB=A7=8C=20=EC=88=98=ED=96=89=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=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-check.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index fd659064..e90d57db 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -14,23 +14,14 @@ jobs: - uses: actions/checkout@v3 - name: Set up JDK 21 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 21 distribution: 'temurin' - - - name: Cache Gradle - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- + cache: 'gradle' - name: Check Build - run: ./gradlew clean build + run: ./gradlew clean build -x test - name: Run test run: ./gradlew test