From 0547ea935a96ecbbc00e5f2eb50dac9d05223735 Mon Sep 17 00:00:00 2001 From: TinyFrogs <87762815+TinyFrogs@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:44:34 +0900 Subject: [PATCH 1/8] config: Create gradleCI.yml --- .github/workflows/gradleCI.yml | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/gradleCI.yml diff --git a/.github/workflows/gradleCI.yml b/.github/workflows/gradleCI.yml new file mode 100644 index 00000000..a90d0355 --- /dev/null +++ b/.github/workflows/gradleCI.yml @@ -0,0 +1,67 @@ +# 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: Java CI with Gradle + +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 + + - name: Build with Gradle Wrapper + run: ./gradlew build + + # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). + # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. + # + # - name: Setup Gradle + # uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 + # with: + # gradle-version: '8.5' + # + # - name: Build with Gradle 8.5 + # run: gradle build + + dependency-submission: + + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 From db62a44cd9c2c9a9861cd6c58542181cda2e3e40 Mon Sep 17 00:00:00 2001 From: spiky-haired-Pyramid-head Date: Tue, 9 Apr 2024 14:45:18 +0900 Subject: [PATCH 2/8] =?UTF-8?q?refactor:=20gradleCD=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{gradle.yml => gradleCD.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{gradle.yml => gradleCD.yml} (100%) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradleCD.yml similarity index 100% rename from .github/workflows/gradle.yml rename to .github/workflows/gradleCD.yml From 6f95be9556e20acb7960e9933e265f11ddd77ff2 Mon Sep 17 00:00:00 2001 From: spiky-haired-Pyramid-head Date: Mon, 29 Apr 2024 14:31:44 +0900 Subject: [PATCH 3/8] =?UTF-8?q?config:=20JacocoTestCoverage=20=EC=88=98?= =?UTF-8?q?=EC=B9=98=EB=A5=BC=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EB=8A=94=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradleCI.yml | 75 ++++++++++++---------------------- 1 file changed, 26 insertions(+), 49 deletions(-) diff --git a/.github/workflows/gradleCI.yml b/.github/workflows/gradleCI.yml index a90d0355..7307fed4 100644 --- a/.github/workflows/gradleCI.yml +++ b/.github/workflows/gradleCI.yml @@ -1,67 +1,44 @@ -# 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: Java CI with Gradle on: push: branches: [ "develop" ] pull_request: - branches: [ "develop" ] + branches: [ "*" ] + +permissions: + contents: read -jobs: - build: +jobs: + build-and-test: runs-on: ubuntu-latest - permissions: - contents: read + timeout-minutes: 10 steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' + - name: Checkout Code + uses: actions/checkout@v3 - # Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies. - # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - - name: Setup Gradle - uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' - - name: Build with Gradle Wrapper - run: ./gradlew build + - name: Run chmod to make gradlew executable + run: chmod +x ./gradlew - # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). - # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. - # - # - name: Setup Gradle - # uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 - # with: - # gradle-version: '8.5' - # - # - name: Build with Gradle 8.5 - # run: gradle build + - name: Test with JaCoCo + run: ./gradlew test jacocoTestReport - dependency-submission: + - name: Check jacocoTestCoverage + run: ./gradlew test jacocoTestCoverageVerification + + - name: Upload JaCoCo Coverage Report + uses: actions/upload-artifact@v3 + with: + name: jacoco-report + path: build/reports/jacoco/test/html/ - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. - # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md - - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 From da7389924350d198cd255d1dc9d3614e6fe86855 Mon Sep 17 00:00:00 2001 From: spiky-haired-Pyramid-head Date: Mon, 29 Apr 2024 14:35:25 +0900 Subject: [PATCH 4/8] =?UTF-8?q?config:=20JacocoTestCoverage=20=EC=88=98?= =?UTF-8?q?=EC=B9=98=EB=A5=BC=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EB=8A=94=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradleCI.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/gradleCI.yml b/.github/workflows/gradleCI.yml index 7307fed4..1f8530c2 100644 --- a/.github/workflows/gradleCI.yml +++ b/.github/workflows/gradleCI.yml @@ -29,10 +29,7 @@ jobs: run: chmod +x ./gradlew - name: Test with JaCoCo - run: ./gradlew test jacocoTestReport - - - name: Check jacocoTestCoverage - run: ./gradlew test jacocoTestCoverageVerification + run: ./gradlew build jacocoTestReport - name: Upload JaCoCo Coverage Report uses: actions/upload-artifact@v3 From 3220458c64d5f320495c06f2586c1a0d802a37d8 Mon Sep 17 00:00:00 2001 From: spiky-haired-Pyramid-head Date: Mon, 29 Apr 2024 14:40:53 +0900 Subject: [PATCH 5/8] =?UTF-8?q?config:=20application-API-KEY=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EC=96=B4=EC=A3=BC=EB=8A=94=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradleCI.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/gradleCI.yml b/.github/workflows/gradleCI.yml index 1f8530c2..9b1fa329 100644 --- a/.github/workflows/gradleCI.yml +++ b/.github/workflows/gradleCI.yml @@ -25,6 +25,15 @@ jobs: java-version: '17' distribution: 'temurin' + # 환경별 properties 파일 생성 - API-KEY + - name: make application-API-KEY.properties + run: | + cd ./src/main/resources + touch ./application-API-KEY.properties + echo "${{ secrets.YML_CI }}" > ./application-API-KEY.properties + shell: bash + + - name: Run chmod to make gradlew executable run: chmod +x ./gradlew From 6d1f5d3fd33f07ac1d612eeb27752357d9bc3dd4 Mon Sep 17 00:00:00 2001 From: spiky-haired-Pyramid-head Date: Mon, 29 Apr 2024 15:17:57 +0900 Subject: [PATCH 6/8] =?UTF-8?q?config:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BB=A4=EB=B2=84=EB=A6=AC=20=EC=B2=B4=ED=81=AC=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=20=ED=99=95=EC=9D=B8=20=EC=BD=94=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradleCI.yml | 11 ++++++++--- build.gradle | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradleCI.yml b/.github/workflows/gradleCI.yml index 9b1fa329..d623d128 100644 --- a/.github/workflows/gradleCI.yml +++ b/.github/workflows/gradleCI.yml @@ -33,18 +33,23 @@ jobs: echo "${{ secrets.YML_CI }}" > ./application-API-KEY.properties shell: bash - - name: Run chmod to make gradlew executable run: chmod +x ./gradlew + # gradle build + - name: Build with Gradle + run: ./gradlew clean build -x test + - name: Test with JaCoCo run: ./gradlew build jacocoTestReport - name: Upload JaCoCo Coverage Report - uses: actions/upload-artifact@v3 + uses: madrapps/jacoco-report@v1.2 with: name: jacoco-report - path: build/reports/jacoco/test/html/ + path: leaguehub-backend/build/reports/jacoco/test/html/jacocoTestReport.xml + token: ${{ secrets.GIT_TOKEN }} + title: "테스트 커버리지 측정" diff --git a/build.gradle b/build.gradle index 759b9eb4..96a61f25 100644 --- a/build.gradle +++ b/build.gradle @@ -118,6 +118,9 @@ test { } jacocoTestReport { dependsOn test + reports{ + xml.required = true + } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { From 3a1c038b5905257abbe1ce23e302f52d6452cf79 Mon Sep 17 00:00:00 2001 From: spiky-haired-Pyramid-head Date: Mon, 29 Apr 2024 15:49:09 +0900 Subject: [PATCH 7/8] =?UTF-8?q?config:=20CI=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradleCI.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/gradleCI.yml b/.github/workflows/gradleCI.yml index d623d128..aec37a82 100644 --- a/.github/workflows/gradleCI.yml +++ b/.github/workflows/gradleCI.yml @@ -40,16 +40,16 @@ jobs: - name: Build with Gradle run: ./gradlew clean build -x test - - name: Test with JaCoCo - run: ./gradlew build jacocoTestReport - - - name: Upload JaCoCo Coverage Report - uses: madrapps/jacoco-report@v1.2 - with: - name: jacoco-report - path: leaguehub-backend/build/reports/jacoco/test/html/jacocoTestReport.xml - token: ${{ secrets.GIT_TOKEN }} - title: "테스트 커버리지 측정" +# - name: Test with JaCoCo +# run: ./gradlew build jacocoTestReport +# +# - name: Upload JaCoCo Coverage Report +# uses: madrapps/jacoco-report@v1.2 +# with: +# name: jacoco-report +# path: leaguehub-backend/build/reports/jacoco/test/html/jacocoTestReport.xml +# token: ${{ secrets.GIT_TOKEN }} +# title: "테스트 커버리지 측정" From 6424982ee3643054a08394e605b48809236235a2 Mon Sep 17 00:00:00 2001 From: spiky-haired-Pyramid-head Date: Tue, 30 Apr 2024 17:21:49 +0900 Subject: [PATCH 8/8] =?UTF-8?q?config:=20=EC=A0=95=EC=84=9D=EB=B6=84?= =?UTF-8?q?=EC=84=9D=EA=B8=B0=20sonar=20=ED=81=B4=EB=9D=BC=EC=9A=B0?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradleCI.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/gradleCI.yml b/.github/workflows/gradleCI.yml index aec37a82..dc800866 100644 --- a/.github/workflows/gradleCI.yml +++ b/.github/workflows/gradleCI.yml @@ -40,16 +40,8 @@ jobs: - name: Build with Gradle run: ./gradlew clean build -x test -# - name: Test with JaCoCo -# run: ./gradlew build jacocoTestReport -# -# - name: Upload JaCoCo Coverage Report -# uses: madrapps/jacoco-report@v1.2 -# with: -# name: jacoco-report -# path: leaguehub-backend/build/reports/jacoco/test/html/jacocoTestReport.xml -# token: ${{ secrets.GIT_TOKEN }} -# title: "테스트 커버리지 측정" - - - + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file