Skip to content

Commit 83a1797

Browse files
Feature/GitHub actions (#1)
* actionsを修正 * actionsを修正 * actionsを修正 * actionsを修正 * actionsを修正 * actionsを修正 * actionsを修正 * actionsを修正 * actionsを修正 * actionsを修正 * actionsを修正 * actionsを修正
1 parent 18c015e commit 83a1797

File tree

2 files changed

+43
-7
lines changed

2 files changed

+43
-7
lines changed

.github/workflows/build.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
name: Build
1+
name: Build and Test with jOOQ and Docker
22

33
on:
4+
pull_request:
5+
branches:
6+
- main
47
push:
58
branches:
69
- main
10+
- feature/*
711
workflow_dispatch:
812

913
jobs:
@@ -14,14 +18,44 @@ jobs:
1418
- name: Checkout repository
1519
uses: actions/checkout@v3
1620

21+
- name: Install Docker Compose
22+
run: |
23+
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
24+
sudo chmod +x /usr/local/bin/docker-compose
25+
26+
- name: Start MySQL with Docker Compose
27+
run: docker-compose up -d
28+
29+
- name: Wait for MySQL to initialize
30+
run: |
31+
timeout 60s bash -c '
32+
CONTAINER_ID=$(docker ps -qf "name=mysql")
33+
until docker exec $CONTAINER_ID mysqladmin ping -uroot -prootpassword --silent; do
34+
echo "Waiting for MySQL to be ready..."
35+
sleep 5
36+
done
37+
'
38+
39+
- name: Verify MySQL Initialization
40+
run: |
41+
docker exec mysql mysql -uroot -prootpassword -e "SHOW TABLES;" sampledb || echo "No tables found"
42+
43+
- name: MySQL Container Logs
44+
if: failure()
45+
run: docker-compose logs mysql
46+
1747
- name: Set up JDK 21
1848
uses: actions/setup-java@v3
1949
with:
2050
distribution: 'temurin'
2151
java-version: '21'
2252

23-
- name: Build Skeleton Batch with Gradle
24-
run: ./gradlew :skeletonBatch:build
53+
- name: Generate jOOQ Classes and Build
54+
run: ./gradlew clean generateJooq build --info --stacktrace
2555

26-
- name: Run Skeleton Batch
27-
run: ./gradlew :skeletonBatch:bootRun
56+
- name: Archive Test Reports
57+
if: always()
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: test-reports
61+
path: build/reports/tests/test

compose.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
version: '3'
1+
version: '3.9'
22
services:
33
mysql:
44
image: mysql:latest
5+
container_name: mysql
56
ports:
67
- 3306:3306
78
environment:
89
MYSQL_ROOT_PASSWORD: rootpassword
910
MYSQL_DATABASE: sampledb
1011
MYSQL_USER: sampleuser
1112
MYSQL_PASSWORD: samplepassword
12-
MYSQL_INITDB_SKIP_TZINFO: 1
13+
volumes:
14+
- ./init-scripts:/docker-entrypoint-initdb.d

0 commit comments

Comments
 (0)