[BLOOM-010] docker compose local db 설정 #23
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: Spring Kotlin CI with MySQL | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.4 | |
env: | |
MYSQL_ROOT_PASSWORD: 1234 | |
MYSQL_DATABASE: blueming | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Print MySQL logs for debugging | |
if: failure() | |
run: docker logs ${{ job.services.mysql.id }} | |
- name: Build with Gradle | |
run: ./gradlew build --warning-mode all | |
env: | |
SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/blueming | |
SPRING_DATASOURCE_USERNAME: root | |
SPRING_DATASOURCE_PASSWORD: 1234 | |
- name: Run tests | |
run: ./gradlew test --warning-mode all | |
env: | |
SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/blueming | |
SPRING_DATASOURCE_USERNAME: root | |
SPRING_DATASOURCE_PASSWORD: 1234 | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle |