Skip to content

Commit

Permalink
Merge pull request #20 from shoeone96/feature-ci
Browse files Browse the repository at this point in the history
Feature ci
  • Loading branch information
shoeone96 authored Dec 21, 2023
2 parents 3333f80 + e90a4d0 commit ccb1ab6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/pr_sync_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Spring Boot Gradle Test Workflow

on: [ pull_request ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Repository checkout
uses: actions/checkout@v2

- name: Setup MySQL
uses: mirromutth/[email protected]
with:
mysql database: ${{secrets.TEST_DATABASE}}
mysql user: ${{secrets.TEST_DB_USERNAME}}
mysql password: ${{secrets.TEST_DB_PASSWORD}}
# run 명령어로 schema 만드는 명령어 실행
run: mysql -u ${{secrets.TEST_DB_USERNAME}} -p=${{secrets.TEST_DB_PASSWORD}} < ../.././mysql/schema.sql

# java 설치
- name: Set up JDK 17
uses: actions/[email protected]
with:
java-version: '17'
distribution: 'liberica'

# 환경 변수 적용
- name: Configure application.yaml under test directory
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application.yaml
env:
spring.datasource.url: jdbc:mysql://localhost:3306/${{ secrets.TEST_DATABASE }}
spring.datasource.username: ${{ secrets.TEST_DB_USERNAME }}
spring.datasource.password: ${{ secrets.TEST_DB_PASSWORD }}

# gradle 권한 추가
- name: Grant execute permission for gradlew
run: chmod +x gradlew

# 프로젝트 빌드
- name: Build with Gradle
run: ./gradlew clean build

# 테스트 실행
- name: Run Tests
run: ./gradlew test
2 changes: 1 addition & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://localhost:3308/ootw
url: jdbc:mysql://localhost:3306/ootw
jpa:
hibernate:
ddl-auto: validate
Expand Down
10 changes: 10 additions & 0 deletions src/test/resources/application-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://localhost:3306/ootw
jpa:
hibernate:
ddl-auto: validate
open-in-view: false

0 comments on commit ccb1ab6

Please sign in to comment.