flyway ci 검증 추가 #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Setup MySQL | |
uses: mirromutth/[email protected] | |
with: | |
host port: 7777 | |
container port: 3306 | |
mysql database: testdb | |
mysql user: 'test' | |
mysql password: 'password' | |
- name: Wait for MySQL to start | |
run: sleep 10 | |
- 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: Create flyway.conf | |
run: | | |
touch flyway.conf | |
echo "flyway.driver=com.mysql.cj.jdbc.Driver" >> flyway.conf | |
echo "flyway.url=jdbc:mysql://localhost:7777/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 | |
./gradlew -Dflyway.configFiles=flyway.conf flywayValidate --stacktrace | |
working-directory: ./backend/ddang |