Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/env/728' into env/728
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ503 committed Nov 2, 2023
2 parents 3dfd056 + 568985e commit d86ce1a
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/backend_dev_flyway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: dev flyway 검증

on:
pull_request:
types: [opened, reopened, synchronize]
branches: [develop-be]

permissions: write-all
jobs:
build:
if: contains(github.event.pull_request.labels.*.name, 'backend')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: settings java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: cache gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: chmod gradle
run: chmod +x backend/ddang/gradlew

- name: Set up Docker Compose
run: docker-compose -f .github/workflows/docker-compose.yml up -d

- name: Wait for MySQL to be ready
run: |
while [ -z "$DATABASE_URL" ]; do
echo "Waiting for MySQL to be ready..."
export DATABASE_URL=$(echo "SELECT 'ready';" | mysql -h127.0.0.1 -P3306 -utest -ppassword testdb --skip-column-names 2>/dev/null)
sleep 1
done
echo "$DATABASE_URL"
docker ps
- name: Create flyway.conf
run: |
touch flyway.conf
echo "flyway.driver=com.mysql.cj.jdbc.Driver" >> flyway.conf
echo "flyway.url=jdbc:mysql://127.0.0.1:3306/testdb" >> flyway.conf
echo "flyway.user=test" >> flyway.conf
echo "flyway.password=password" >> flyway.conf
echo "flyway.encoding=UTF-8" >> flyway.conf
echo "flyway.locations=filesystem:src/main/resources/db/migration" >> flyway.conf
echo "flyway.validateOnMigrate=true" >> flyway.conf
working-directory: ./backend/ddang

- name: flywayValidate
run: |
./gradlew -Dflyway.configFiles=flyway.conf flywayMigrate --stacktrace
working-directory: ./backend/ddang

- name: Shut down Docker Compose
run: docker-compose -f .github/docker-compose.yml down
12 changes: 12 additions & 0 deletions .github/workflows/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3.9"
services:
mysql:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: testdb
MYSQL_USER: test
MYSQL_PASSWORD: password
ports:
- "3306:3306"

0 comments on commit d86ce1a

Please sign in to comment.