From d029effea3ab08c9abf87a444a27728f67856826 Mon Sep 17 00:00:00 2001 From: Hong <77445491+qwe916@users.noreply.github.com> Date: Sat, 6 Jan 2024 10:39:38 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20pull=20requset=EC=8B=9C=20comment?= =?UTF-8?q?=EA=B0=80=20=EC=9E=91=EC=84=B1=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#131)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: pull requset시 comment가 작성되도록 수정 * comment: 배포 중단 주석 추가 * feat: codecov token 추가 * fix: codecov 버전 수정 * feat: codecoverage.yml로 추출 * refactor: git action workflow 파일 위치 변경 * feat: test job 추가 --- .github/workflows/cicd.yml | 31 ++++++------- .github/workflows/codecoverage.yml | 48 ++++++++++++++++++++ build.gradle | 8 ++-- .github/workflows/codecov.yml => codecov.yml | 0 src/test/resources/application.yml | 12 ++--- 5 files changed, 71 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/codecoverage.yml rename .github/workflows/codecov.yml => codecov.yml (100%) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 412b0999..c1d8964c 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -11,7 +11,7 @@ name: CI/CD on: push: branches: [ "main" ] - + permissions: contents: read @@ -40,11 +40,6 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - file: ./build/jacoco/index.xml - # gradlew 파일 권한 지정 - name: Grant execute permission for gradlew run: chmod +x gradlew @@ -54,15 +49,15 @@ jobs: run: ./gradlew jib - # ssh로 접속해 재배포 - - name: Deploy - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.REMOTE_IP }} - username: ${{ secrets.REMOTE_SSH_ID }} - key: ${{ secrets.REMOTE_SSH_KEY }} - port: ${{ secrets.REMOTE_SSH_PORT }} - script: | - cd docker - docker compose pull wanf - docker compose up -d wanf + # ssh로 접속해 재배포 (2024 . 01 . 06 배포 중단) + #- name: Deploy + # uses: appleboy/ssh-action@master + # with: + # host: ${{ secrets.REMOTE_IP }} + # username: ${{ secrets.REMOTE_SSH_ID }} + # key: ${{ secrets.REMOTE_SSH_KEY }} + # port: ${{ secrets.REMOTE_SSH_PORT }} + # script: | + # cd docker + # docker compose pull wanf + # docker compose up -d wanf diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml new file mode 100644 index 00000000..ae5e1754 --- /dev/null +++ b/.github/workflows/codecoverage.yml @@ -0,0 +1,48 @@ +name: Code Coverage + +on: + push: + branches: [ '*' ] + pull_request: + branches: + - 'main' + +permissions: + contents: read + +jobs: + code-coverage: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + # JDK 17 설정 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'oracle' + + + # Gradle 설정 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + with: + cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/dev' }} + + # gradlew 파일 권한 지정 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: test + run: ./gradlew test + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + if: always() + env: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./build/reports/jacoco/test/jacocoTestReport.xml + fail_ci_if_error: true + continue-on-error: true \ No newline at end of file diff --git a/build.gradle b/build.gradle index ed99fdff..6cbad1e4 100644 --- a/build.gradle +++ b/build.gradle @@ -70,6 +70,7 @@ jacoco { test { useJUnitPlatform() finalizedBy 'jacocoTestReport' + exclude '**/*Controller*', '**/*Application*', '**/ProfileRepositoryTest*' jacoco { excludes += ["com/capstone/wanf/error", @@ -95,12 +96,11 @@ bootBuildImage { jacocoTestReport { reports { xml.enabled true - csv.enabled true + csv.enabled false html.enabled true - xml.destination file("${buildDir}/jacoco/index.xml") - csv.destination file("${buildDir}/jacoco/index.csv") - html.destination file("${buildDir}/jacoco/index.html") + xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml") + html.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.html") } finalizedBy 'jacocoTestCoverageVerification' diff --git a/.github/workflows/codecov.yml b/codecov.yml similarity index 100% rename from .github/workflows/codecov.yml rename to codecov.yml diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 15d52c90..9c03110e 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -20,8 +20,8 @@ spring: default-encoding: UTF-8 host: smtp.gmail.com port: 587 - username: ${GOOGLE_MAIL} - password: ${GOOGLE_PASSWORD} + username: google email + password: google password properties: mail: smtp: @@ -32,11 +32,11 @@ spring: trust: smtp.gmail.com kafka: producer: - bootstrap-servers: ${KAFKA_HOST}:${KAFKA_PORT} + bootstrap-servers: localhost:9092 key-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.springframework.kafka.support.serializer.JsonSerializer consumer: - bootstrap-servers: ${KAFKA_HOST}:${KAFKA_PORT} + bootstrap-servers: localhost:9092 group-id: wanf auto-offset-reset: earliest key-deserializer: org.apache.kafka.common.serialization.StringDeserializer @@ -65,8 +65,8 @@ cors: cloud: aws: credentials: - access-key: ${AWS_ACCESS_KEY} - secret-key: ${AWS_SECRET_KEY} + access-key: aws access key + secret-key: aws secret key region: static: ap-northeast-2 s3: