Skip to content

Commit

Permalink
infra: 백엔드 cicd 환경 설정 (#142)
Browse files Browse the repository at this point in the history
* fix: truncate 를 통한 테스트 데이터 초기화 (#139)

* chore: application.yml 배포환경별 설정 (#139)

* fix: ddl-auto 수정 (#139)

* fix: application yml 변수 설정 (#139)

* feat: 위도, 경도 반환 타입을 Double로 변경 (#139)

* infra: 백엔드 CI 작성 (#139)

* infra: 백엔드 CI 오류 수정 (#139)

* infra: workflow 수정 (#139)

* Update backend-dev-cd.yml

---------

Co-authored-by: Taeyeon <[email protected]>
  • Loading branch information
shin-mallang and TaeyeonRoyce authored Jul 20, 2023
1 parent 3c00dce commit 95fc107
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 22 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: ✨ Celuveat Backend CI ✨

on:
push:
branches: [ "develop-backend" ]
pull_request:
branches: [ "develop-backend" ]

permissions:
checks: write
pull-requests: write

jobs:
backend-test:
runs-on: ubuntu-latest
env:
working-directory: ./backend

steps:
- uses: actions/checkout@v3
- name: ✨ JDK 17 설정
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: ✨ Gradlew 권한 설정
run: chmod +x ./gradlew
working-directory: ${{ env.working-directory }}

- name: ✨ 테스트 진행
run: ./gradlew test
working-directory: ${{ env.working-directory }}

- name: ✨ 테스트 결과 Report
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ always() }}
with:
files: '**/build/test-results/**/*.xml'

- name: ✨ 테스트 실패 Comment
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
18 changes: 18 additions & 0 deletions .github/workflows/backend-dev-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ✨ Celuveat backend DEV CD ✨

on:
push:
branches:
- develop-backend
paths:
- 'backend/**'

jobs:
deploy-backend:
runs-on: self-hosted

steps:
- name: ✨ Run Backend Deploy Script
run: |
cd ~
sudo sh deploy-backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public record RestaurantQueryResponse(
String name,
String category,
String roadAddress,
String latitude,
String longitude,
Double latitude,
Double longitude,
String phoneNumber,
String naverMapUrl,
List<CelebQueryResponse> celebs,
Expand All @@ -28,8 +28,8 @@ public static RestaurantQueryResponse from(
restaurant.name(),
restaurant.category(),
restaurant.roadAddress(),
restaurant.latitude(),
restaurant.longitude(),
Double.valueOf(restaurant.latitude()),
Double.valueOf(restaurant.longitude()),
restaurant.phoneNumber(),
restaurant.naverMapUrl(),
celebs.stream().map(CelebQueryResponse::of).toList(),
Expand Down
14 changes: 5 additions & 9 deletions backend/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ logging:

spring:
datasource:
url: jdbc:h2:mem:testdb;MODE=MySQL
username: sa
password:

h2:
console:
enabled: true
path: /h2-console
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: ${DB_DRIVER_CLASS_NAME}

jpa:
show-sql: true
Expand All @@ -23,4 +19,4 @@ spring:
highlight_sql: true

hibernate:
ddl-auto: create
ddl-auto: validate
10 changes: 10 additions & 0 deletions backend/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
spring:
datasource:
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: ${DB_DRIVER_CLASS_NAME}

jpa:
hibernate:
ddl-auto: validate
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class RestaurantFixture {
.naverMapUrl(name)
.phoneNumber(name)
.category(name)
.latitude(name)
.longitude(name)
.latitude("37.5206993")
.longitude("127.019975")
.build();
}
}
7 changes: 0 additions & 7 deletions backend/src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
logging:
level:
org.hibernate.orm.jdbc.bind: TRACE
org.apache.coyote.http11: debug #Http 요청정보 로그 남기기

spring:
profiles:
Expand All @@ -12,11 +11,6 @@ spring:
username: sa
password:

h2:
console:
enabled: true
path: /h2-console

jpa:
show-sql: true
properties:
Expand All @@ -25,6 +19,5 @@ spring:
use_sql_comments: true
highlight_sql: true


hibernate:
ddl-auto: create

0 comments on commit 95fc107

Please sign in to comment.