Skip to content

Commit f74994d

Browse files
committed
fix: ci
1 parent a132285 commit f74994d

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ jobs:
6565
test:
6666
name: Unit Test
6767
runs-on: ubuntu-latest
68+
services:
69+
mysql:
70+
image: mysql:9.0.1
71+
env:
72+
MYSQL_ROOT_PASSWORD: fzu-helper
73+
MYSQL_DATABASE: fzu-helper
74+
MYSQL_USER: fzu-helper
75+
MYSQL_PASSWORD: fzu-helper
76+
ports:
77+
- 3306:3306
78+
options: >-
79+
--health-cmd="mysqladmin ping -h 127.0.0.1 -ufzu-helper -pfzu-helper"
80+
--health-interval=10s
81+
--health-timeout=5s
82+
--health-retries=10
6883
steps:
6984
- name: Checkout
7085
uses: actions/checkout@v7
@@ -77,6 +92,13 @@ jobs:
7792
cache: false
7893
- name: Install dependencies
7994
run: go mod tidy
95+
- name: Initialize test database
96+
run: |
97+
sudo apt-get update
98+
sudo apt-get install -y mysql-client
99+
for file in config/sql/*.sql; do
100+
mysql --protocol=tcp -h 127.0.0.1 -P 3306 -ufzu-helper -pfzu-helper fzu-helper < "$file"
101+
done
80102
- name: Run tests
81103
run: make test # 使用我们自己的测试命令
82104
- name: Check the number of changed lines

0 commit comments

Comments
 (0)