From 9d84240b97bcfadb5716b1d2380c6524c97ad21c Mon Sep 17 00:00:00 2001 From: shoeone96 Date: Thu, 21 Dec 2023 19:55:18 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20CI=20pipeline=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr_sync_ci.yaml | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/pr_sync_ci.yaml diff --git a/.github/workflows/pr_sync_ci.yaml b/.github/workflows/pr_sync_ci.yaml new file mode 100644 index 00000000..609d153e --- /dev/null +++ b/.github/workflows/pr_sync_ci.yaml @@ -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/mysql-action@v1.1 + 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/setup-java@v4.0.0 + 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