update #309
This file contains 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: unittest | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
db: | |
image: mysql:8.1.0 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: test | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Wait for MySQL to start | |
run: sleep 15s | |
- name: Create databases | |
run: | | |
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e "CREATE DATABASE IF NOT EXISTS test;" | |
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e "CREATE DATABASE IF NOT EXISTS test1;" | |
- name: check out repository code | |
uses: actions/checkout@v3 | |
- name: Set up go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21.1 | |
- name: go test | |
run: go test ./... | |