From ab411c37e553da8a81b5a2419354682e572edeb8 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Thu, 30 Nov 2023 18:49:29 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20Github=20Actions=E3=82=92=E4=B8=A6?= =?UTF-8?q?=E5=88=97=E5=AE=9F=E8=A1=8C=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/coverage.yml | 34 --- .github/workflows/integration-test.yml | 67 ----- .../workflows/pull-request-merge-check.yml | 237 ++++++++++++++++++ .github/workflows/test.yml | 63 ----- 4 files changed, 237 insertions(+), 164 deletions(-) delete mode 100644 .github/workflows/coverage.yml delete mode 100644 .github/workflows/integration-test.yml create mode 100644 .github/workflows/pull-request-merge-check.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 6bb91364..00000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Coverage - -on: - pull_request: -permissions: - pull-requests: write - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Run JUnit - uses: gradle/gradle-build-action@v2.8.1 - with: - arguments: koverXmlReport -x integrationTest - - name: Add coverage report to PR - if: always() - id: kover - uses: mi-kas/kover-report@v1 - with: - path: | - ${{ github.workspace }}/build/reports/kover/report.xml - token: ${{ secrets.GITHUB_TOKEN }} - title: Code Coverage - update-comment: true - min-coverage-overall: 80 - min-coverage-changed-files: 80 - coverage-counter-type: LINE diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml deleted file mode 100644 index ca866978..00000000 --- a/.github/workflows/integration-test.yml +++ /dev/null @@ -1,67 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle - -name: Integration Test - -on: - pull_request: - branches: [ "develop" ] - -permissions: - contents: read - checks: write - id-token: write - -jobs: - integration-test: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Cache - uses: actions/cache@v3.3.2 - with: - path: ~/.gradle/wrapper - key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - name: Cache - uses: actions/cache@v3.3.2 - with: - path: | - ~/.gradle/caches/jars-* - ~/.gradle/caches/transforms-* - ~/.gradle/caches/modules-* - key: gradle-dependencies-${{ steps.cache-key.outputs.week }}-${{ hashFiles('**/*.gradle.kts') }} - restore-keys: gradle-dependencies-${{ steps.cache-key.outputs.week }}- - - name: Cache - uses: actions/cache@v3.3.2 - with: - path: | - ~/.gradle/caches/build-cache-* - ~/.gradle/caches/[0-9]*.* - .gradle - key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}-${{ github.sha }} - restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}- - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: MongoDB in GitHub Actions - uses: supercharge/mongodb-github-action@1.10.0 - with: - mongodb-version: latest - - name: Run Integration Test - uses: gradle/gradle-build-action@v2.8.1 - with: - arguments: integrationTest - - name: Publish Test Report - uses: mikepenz/action-junit-report@v2 - if: always() - with: - report_paths: '**/build/test-results/integrationTest/TEST-*.xml' diff --git a/.github/workflows/pull-request-merge-check.yml b/.github/workflows/pull-request-merge-check.yml new file mode 100644 index 00000000..035205cd --- /dev/null +++ b/.github/workflows/pull-request-merge-check.yml @@ -0,0 +1,237 @@ +on: + pull_request: + branches: + - "develop" + + +permissions: + contents: read + checks: write + id-token: write + pull-requests: write + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Gradle Wrapper Cache + uses: actions/cache@v3.3.2 + with: + path: ~/.gradle/wrapper + key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + - name: Dependencies Cache + uses: actions/cache@v3.3.2 + with: + path: | + ~/.gradle/cache/jars-* + ~/.gradle/caches/transforms-* + ~/.gradle/caches/modules-* + key: gradle-dependencies-${{ steps.cache-key.outputs.week }}-${{ hashFiles('**/*.gradle.kts') }} + restore-keys: gradle-dependencies-${{ steps.cache-key.outputs.week }}- + + - name: Cache + uses: actions/cache@v3.3.2 + with: + path: | + ~/.gradle/caches/build-cache-* + ~/.gradle/caches/[0-9]*.* + .gradle + key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}- + + - name: Build Cache + uses: actions/cache@v3.3.2 + with: + path: | + build + key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }} + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Build + uses: gradle/gradle-build-action@2.8.1 + with: + arguments: testClasses + + unit-test: + needs: [ setup ] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Gradle Wrapper Cache + uses: actions/cache@v3.3.2 + with: + path: ~/.gradle/wrapper + key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + - name: Dependencies Cache + uses: actions/cache@v3.3.2 + with: + path: | + ~/.gradle/cache/jars-* + ~/.gradle/caches/transforms-* + ~/.gradle/caches/modules-* + key: gradle-dependencies-${{ steps.cache-key.outputs.week }}-${{ hashFiles('**/*.gradle.kts') }} + restore-keys: gradle-dependencies-${{ steps.cache-key.outputs.week }}- + + - name: Cache + uses: actions/cache@v3.3.2 + with: + path: | + ~/.gradle/caches/build-cache-* + ~/.gradle/caches/[0-9]*.* + .gradle + key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}- + + - name: Build Cache + uses: actions/cache@v3.3.2 + with: + path: | + build + key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }} + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Unit Test + uses: gradle/gradle-build-action@2.8.1 + with: + arguments: test + + integration-test: + needs: [ setup ] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Gradle Wrapper Cache + uses: actions/cache@v3.3.2 + with: + path: ~/.gradle/wrapper + key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + - name: Dependencies Cache + uses: actions/cache@v3.3.2 + with: + path: | + ~/.gradle/cache/jars-* + ~/.gradle/caches/transforms-* + ~/.gradle/caches/modules-* + key: gradle-dependencies-${{ steps.cache-key.outputs.week }}-${{ hashFiles('**/*.gradle.kts') }} + restore-keys: gradle-dependencies-${{ steps.cache-key.outputs.week }}- + + - name: Cache + uses: actions/cache@v3.3.2 + with: + path: | + ~/.gradle/caches/build-cache-* + ~/.gradle/caches/[0-9]*.* + .gradle + key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}- + + - name: Build Cache + uses: actions/cache@v3.3.2 + with: + path: | + build + key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }} + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Unit Test + uses: gradle/gradle-build-action@2.8.1 + with: + arguments: integrationTest + + coverage: + needs: [ setup ] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Gradle Wrapper Cache + uses: actions/cache@v3.3.2 + with: + path: ~/.gradle/wrapper + key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + - name: Dependencies Cache + uses: actions/cache@v3.3.2 + with: + path: | + ~/.gradle/cache/jars-* + ~/.gradle/caches/transforms-* + ~/.gradle/caches/modules-* + key: gradle-dependencies-${{ steps.cache-key.outputs.week }}-${{ hashFiles('**/*.gradle.kts') }} + restore-keys: gradle-dependencies-${{ steps.cache-key.outputs.week }}- + + - name: Cache + uses: actions/cache@v3.3.2 + with: + path: | + ~/.gradle/caches/build-cache-* + ~/.gradle/caches/[0-9]*.* + .gradle + key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}- + + - name: Build Cache + uses: actions/cache@v3.3.2 + with: + path: | + build + key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }} + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Run Kover + uses: gradle/gradle-build-action@v2.8.1 + with: + arguments: koverXmlReport -x integrationTest + + - name: Add coverage report to PR + if: always() + id: kover + uses: mi-kas/kover-report@v1 + with: + path: | + ${{ github.workspace }}/build/reports/kover/report.xml + token: ${{ secrets.GITHUB_TOKEN }} + title: Code Coverage + update-comment: true + min-coverage-overall: 80 + min-coverage-changed-files: 80 + coverage-counter-type: LINE + + report-tests: + if: success() || failure() + runs-on: ubuntu-latest + steps: + - name: JUnit Test Report + uses: mikepenz/action-junit-report@v2 + with: + report_paths: '**/build/test-results/*/TEST-*.xml' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index dca2a97b..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,63 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle - -name: Test - -on: - pull_request: - branches: [ "develop" ] - -permissions: - contents: read - checks: write - id-token: write - -jobs: - test: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Cache - uses: actions/cache@v3.3.2 - with: - path: ~/.gradle/wrapper - key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - name: Cache - uses: actions/cache@v3.3.2 - with: - path: | - ~/.gradle/caches/jars-* - ~/.gradle/caches/transforms-* - ~/.gradle/caches/modules-* - key: gradle-dependencies-${{ steps.cache-key.outputs.week }}-${{ hashFiles('**/*.gradle.kts') }} - restore-keys: gradle-dependencies-${{ steps.cache-key.outputs.week }}- - - name: Cache - uses: actions/cache@v3.3.2 - with: - path: | - ~/.gradle/caches/build-cache-* - ~/.gradle/caches/[0-9]*.* - .gradle - key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}-${{ github.sha }} - restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ steps.cache-key.outputs.week }}- - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Run JUnit - uses: gradle/gradle-build-action@v2.8.1 - with: - arguments: test - - name: Publish Test Report - uses: mikepenz/action-junit-report@v2 - if: always() - with: - report_paths: '**/build/test-results/test/TEST-*.xml'