Skip to content

Commit

Permalink
ci: add mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
lhpqaq committed Aug 28, 2024
1 parent 6a1c1cc commit 4a4c9a9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ jobs:
ports:
- 6379:6379

mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: xzdp
ports:
- 3306:3306
options: >
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v2

Expand All @@ -65,8 +78,24 @@ jobs:
- name: Install dependencies
run: go mod tidy

- name: Wait for MySQL to be ready
run: |
until mysqladmin ping -h 127.0.0.1 --silent; do
echo "Waiting for MySQL..."
sleep 2
done
- name: Import SQL file into MySQL
run: |
mysql -h 127.0.0.1 -P 3306 -u root -ppassword xzdp < resources/xzdp.sql
- name: Run tests
env:
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_PASSWORD: password
MYSQL_DATABASE: xzdp
run: ./script/test.sh

0 comments on commit 4a4c9a9

Please sign in to comment.