forked from go-gorm/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (54 loc) · 1.43 KB
/
Copy pathci.yml
File metadata and controls
64 lines (54 loc) · 1.43 KB
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
name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ "**" ]
jobs:
test:
strategy:
matrix:
go: ['1.23', '1.24', '1.25']
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
services:
mysql:
image: mysql:8
ports:
- 9910:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: gorm
MYSQL_USER: gorm
MYSQL_PASSWORD: gorm
options: >-
--health-cmd="mysqladmin ping -uroot -proot --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Go env
run: go version && go env
- name: Root module tests
run: go test ./...
- name: Wait for MySQL
run: |
for i in {1..60}; do
if nc -z 127.0.0.1 9910; then echo "MySQL is up"; exit 0; fi
sleep 1
done
echo "MySQL did not become ready in time" >&2
exit 1
- name: Examples module tests (SQLite JSON1 + MySQL)
env:
CGO_ENABLED: '1'
MYSQL_DSN: gorm:gorm@tcp(127.0.0.1:9910)/gorm?parseTime=true&charset=utf8mb4&loc=Local
run: |
cd examples
go test -tags json1 ./...