-
Notifications
You must be signed in to change notification settings - Fork 42
88 lines (77 loc) · 2.38 KB
/
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Test
on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ 'oldstable', 'stable' ]
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: pass
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -ppass"
--health-interval 10s
--health-start-period 10s
--health-timeout 5s
--health-retries 10
steps:
- name: MySQL Setup
run: >
echo -e "[client]\nuser = root\npassword = pass\nhost = localhost\nprotocol = tcp" > $HOME/.my.cnf
&& chmod 600 $HOME/.my.cnf
&& mysql --execute 'CREATE DATABASE dialect_droppable;'
&& mysql --execute 'CREATE DATABASE driver_droppable;'
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Install Dependencies
run: go mod download
- name: Run tests
env:
MYSQL_DIALECT_TEST_DSN: root:pass@(localhost:3306)/dialect_droppable?tls=skip-verify&multiStatements=true
MYSQL_DRIVER_TEST_DSN: root:pass@(localhost:3306)/driver_droppable?tls=skip-verify&multiStatements=true
run: go test -timeout 20m -race -covermode atomic -coverprofile=covprofile.out -coverpkg=github.com/stephenafamo/bob/... ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: covprofile.out
flag-name: go-${{ matrix.go }}
parallel: true
finish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true
test-windows-sqlite:
# Run generation test on windows to catch filepath issues
# Testing Postgres and MySQL are not possible since the windows runner
# does not support containers
runs-on: windows-latest
strategy:
matrix:
go: ['stable' ]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Install Dependencies
run: go mod download
- name: Run tests
run: go test -race ./gen/bobgen-sqlite/driver