Skip to content

Commit

Permalink
fix: pull requset시 comment가 작성되도록 수정 (#131)
Browse files Browse the repository at this point in the history
* fix: pull requset시 comment가 작성되도록 수정

* comment: 배포 중단 주석 추가

* feat: codecov token 추가

* fix: codecov 버전 수정

* feat: codecoverage.yml로 추출

* refactor: git action workflow 파일 위치 변경

* feat: test job 추가
  • Loading branch information
qwe916 authored Jan 6, 2024
1 parent b930ecc commit d029eff
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 28 deletions.
31 changes: 13 additions & 18 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name: CI/CD
on:
push:
branches: [ "main" ]

permissions:
contents: read

Expand Down Expand Up @@ -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
Expand All @@ -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
48 changes: 48 additions & 0 deletions .github/workflows/codecoverage.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jacoco {
test {
useJUnitPlatform()
finalizedBy 'jacocoTestReport'
exclude '**/*Controller*', '**/*Application*', '**/ProfileRepositoryTest*'

jacoco {
excludes += ["com/capstone/wanf/error",
Expand All @@ -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'
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d029eff

Please sign in to comment.