fix github actions #3
This file contains hidden or 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: Build and Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:latest | |
| ports: | |
| - 3306:3306 | |
| env: | |
| MYSQL_ROOT_PASSWORD: rootpassword | |
| MYSQL_DATABASE: sampledb | |
| MYSQL_USER: sampleuser | |
| MYSQL_PASSWORD: samplepassword | |
| options: >- | |
| --health-cmd="mysqladmin ping -h localhost --silent" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Wait for MySQL to be ready | |
| run: | | |
| echo "Waiting for MySQL to be ready..." | |
| for i in {1..10}; do | |
| if mysqladmin ping -h 127.0.0.1 --silent; then | |
| echo "MySQL is ready!" | |
| break | |
| fi | |
| echo "MySQL not ready yet. Retrying in 5 seconds..." | |
| sleep 5 | |
| done | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Build with Gradle | |
| run: ./gradlew build |