actionsを修正 #54
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 with jOOQ and Docker | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| - feature/* | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Install Docker Compose | |
| run: | | |
| sudo curl -L "https://github.com/docker/compose/releases/download/v2.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
| sudo chmod +x /usr/local/bin/docker-compose | |
| - name: Start MySQL with Docker Compose | |
| run: docker-compose up -d | |
| - name: Wait for MySQL to initialize | |
| run: | | |
| timeout 60s bash -c ' | |
| CONTAINER_ID=$(docker ps -qf "name=mysql") | |
| until docker exec $CONTAINER_ID mysqladmin ping -uroot -prootpassword --silent; do | |
| echo "Waiting for MySQL to be ready..." | |
| sleep 5 | |
| done | |
| ' | |
| - name: Verify MySQL Initialization | |
| run: | | |
| docker exec mysql mysql -uroot -prootpassword -e "SHOW TABLES;" sampledb || echo "No tables found" | |
| - name: MySQL Container Logs | |
| if: failure() | |
| run: docker-compose logs mysql | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Generate jOOQ Classes and Build | |
| run: ./gradlew clean generateJooq build --info --stacktrace | |
| - name: Archive Test Reports | |
| if: always() | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: test-reports | |
| path: build/reports/tests/test |