-
Notifications
You must be signed in to change notification settings - Fork 62
67 lines (46 loc) · 1.24 KB
/
unit_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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 ./...