Skip to content

Commit aaf9b2b

Browse files
fix github actions
1 parent 9e732c0 commit aaf9b2b

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,38 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

13+
services:
14+
mysql:
15+
image: mysql:latest
16+
ports:
17+
- 3306:3306
18+
env:
19+
MYSQL_ROOT_PASSWORD: rootpassword
20+
MYSQL_DATABASE: sampledb
21+
MYSQL_USER: sampleuser
22+
MYSQL_PASSWORD: samplepassword
23+
options: >-
24+
--health-cmd="mysqladmin ping -h localhost --silent"
25+
--health-interval=10s
26+
--health-timeout=5s
27+
--health-retries=5
28+
1329
steps:
1430
- name: Checkout repository
1531
uses: actions/checkout@v3
1632

33+
- name: Wait for MySQL to be ready
34+
run: |
35+
echo "Waiting for MySQL to be ready..."
36+
for i in {1..10}; do
37+
if mysqladmin ping -h 127.0.0.1 --silent; then
38+
echo "MySQL is ready!"
39+
break
40+
fi
41+
echo "MySQL not ready yet. Retrying in 5 seconds..."
42+
sleep 5
43+
done
44+
1745
- name: Set up JDK 17
1846
uses: actions/setup-java@v3
1947
with:

application-local.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
spring:
2+
datasource:
3+
url: jdbc:mysql://localhost:3306/sampledb
4+
username: sampleuser
5+
password: samplepassword
6+
jpa:
7+
hibernate:
8+
ddl-auto: none
9+
show-sql: true

dbAndCsvBatch/compose.yaml renamed to compose.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version: "3.8"
2+
13
services:
24
mysql:
35
image: mysql:latest
@@ -11,4 +13,9 @@ services:
1113
MYSQL_PASSWORD: samplepassword
1214
volumes:
1315
- ./init-scripts:/docker-entrypoint-initdb.d
14-
restart: always
16+
healthcheck:
17+
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "--silent"]
18+
interval: 10s
19+
timeout: 5s
20+
retries: 5
21+
restart: always
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)