From 7e6b1c52d900a5cf346a4546634d235c9f6c41ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=98=88=EC=A7=84?= <96688810+kwonyj1022@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:16:16 +0900 Subject: [PATCH] =?UTF-8?q?ci:=20flyway=20ci=20=EA=B2=80=EC=A6=9D=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend_dev_flyway.yml | 112 ++++++++++++++--------- 1 file changed, 69 insertions(+), 43 deletions(-) diff --git a/.github/workflows/backend_dev_flyway.yml b/.github/workflows/backend_dev_flyway.yml index e49eece6a..14417da19 100644 --- a/.github/workflows/backend_dev_flyway.yml +++ b/.github/workflows/backend_dev_flyway.yml @@ -6,54 +6,80 @@ on: 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: Checkout repository + uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + + - name: Set up Docker Compose + run: docker-compose -f .github/docker-compose.yml up -d + + - name: Build and test + run: | + ./mvnw clean install + flyway migrate + + - name: Run JUnit tests + run: ./mvnw test + + - name: Shut down Docker Compose + run: docker-compose -f .github/docker-compose.yml down + +# 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: 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: 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: 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: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 - working-directory: ./backend/ddang - - - name: Stop MySQL - run: docker stop mysql +# - 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: 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: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 +# working-directory: ./backend/ddang + +# - name: Stop MySQL +# run: docker stop mysql