-
Notifications
You must be signed in to change notification settings - Fork 0
206 lines (176 loc) · 5.43 KB
/
Copy pathci.yml
File metadata and controls
206 lines (176 loc) · 5.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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
services:
httpbin:
image: mccutchen/go-httpbin:latest
ports:
- 8888:8080
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
# The SQL-parser wasm is built from committed Rust source as a prerequisite of
# the Go build (it is not committed). Only this step needs Rust.
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: tools/sqlparser-wasm
- name: Build SQL-parser wasm
run: make wasm
- name: Run CI
env:
HTTPBIN_URL: http://localhost:8888
DB_PATH: /tmp/taskapp-test.db
run: make ci
- name: Show e2e server logs
if: always()
run: cat /tmp/e2e-server.log 2>/dev/null || true
- name: Build
run: make build
- name: Smoke test - version
run: ./sql-proxy -version
- name: Smoke test - validate config
run: ./sql-proxy -validate -config testdata/config.ci.yaml
test-mysql:
needs: [test]
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: testpass
MYSQL_DATABASE: testdb
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1"
--health-interval=10s
--health-timeout=5s
--health-retries=5
httpbin:
image: mccutchen/go-httpbin:latest
ports:
- 8888:8080
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
# The SQL-parser wasm is built from committed Rust source as a prerequisite of
# the Go build (it is not committed). Only this step needs Rust.
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: tools/sqlparser-wasm
- name: Build SQL-parser wasm
run: make wasm
- name: Run MySQL integration tests
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_PASSWORD: testpass
MYSQL_DATABASE: testdb
run: go test -v -run "MySQL" ./internal/db/
- name: Build
run: go build -o sql-proxy .
- name: Validate MySQL example configs
env:
MYSQL_PASSWORD: testpass
run: |
for f in examples/mysql/*.yaml; do
echo "=== $f ==="
./sql-proxy -validate -config "$f" || exit 1
done
- name: Run MySQL e2e tests
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_PASSWORD: testpass
MYSQL_DATABASE: testdb
HTTPBIN_URL: http://localhost:8888
TASKAPP_CONFIG: testdata/taskapp-mysql.yaml
run: ./e2e/taskapp_test.sh
- name: Show MySQL e2e server logs
if: always()
run: cat /tmp/e2e-server.log 2>/dev/null || true
test-sqlserver:
needs: [test]
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: "TestPass123!"
ports:
- 1433:1433
options: >-
--health-cmd="/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'TestPass123!' -C -Q 'SELECT 1'"
--health-interval=10s
--health-timeout=10s
--health-retries=10
httpbin:
image: mccutchen/go-httpbin:latest
ports:
- 8888:8080
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
# The SQL-parser wasm is built from committed Rust source as a prerequisite of
# the Go build (it is not committed). Only this step needs Rust.
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: tools/sqlparser-wasm
- name: Build SQL-parser wasm
run: make wasm
- name: Create test database
run: |
docker exec $(docker ps -q --filter "ancestor=mcr.microsoft.com/mssql/server:2022-latest") \
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'TestPass123!' -C \
-Q "CREATE DATABASE testdb"
- name: Build
run: go build -o sql-proxy .
- name: Run SQL Server e2e tests
env:
MSSQL_HOST: 127.0.0.1
MSSQL_PORT: 1433
MSSQL_USER: sa
MSSQL_PASSWORD: "TestPass123!"
MSSQL_DATABASE: testdb
HTTPBIN_URL: http://localhost:8888
TASKAPP_CONFIG: testdata/taskapp-sqlserver.yaml
run: ./e2e/taskapp_test.sh
- name: Show SQL Server e2e server logs
if: always()
run: cat /tmp/e2e-server.log 2>/dev/null || true