-
Notifications
You must be signed in to change notification settings - Fork 0
503 lines (464 loc) · 16.9 KB
/
compatibility-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
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
name: Serverless Driver Compatibility Test
on:
schedule:
- cron: "0 22 * * *" # every day at 22:00
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up ticloud
uses: tidbcloud/setup-tidbcloud-cli@v0
with:
api_public_key: ${{ secrets.TLS_PUBLIC_KEY }}
api_private_key: ${{ secrets.TLS_PRIVATE_KEY }}
- name: Get Connection Info
run: |
# delete cluster if exists
set +e
ticloud cluster list 1372813089206721319 -o json > cluster
exitcode="$?"
if [[ "$exitcode" != "0" ]]; then
cat cluster
exit "$exitcode"
fi
total=$(jq '.total' cluster);
for i in $(seq 1 $total);
do
id=`echo $(jq ".items[$i-1].id" cluster) | sed 's/"//g'`
ticloud cluster delete -p 1372813089206721319 -c $id --force;
exitcode="$?"
if [[ "$exitcode" != "0" ]]; then
echo "delete cluster failed"
exit "$exitcode"
fi
done
# create cluster
ticloud cluster create --project-id 1372813089206721319 --cluster-name tls-test --cloud-provider AWS -r us-east-1 --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS;
exitcode="$?"
if [[ "$exitcode" != "0" ]]; then
echo "create cluster failed"
exit "$exitcode"
fi
# get connection info
ticloud cluster list 1372813089206721319 -o json > cluster
exitcode="$?"
if [[ "$exitcode" != "0" ]]; then
cat cluster
exit "$exitcode"
fi
cat cluster
echo "TIDB_CLOUD_USER=$(jq '.items[0].status.connection_strings.default_user' cluster)" >> $GITHUB_ENV
echo "TIDB_CLOUD_HOST=$(jq '.items[0].status.connection_strings.standard.host' cluster)" >> $GITHUB_ENV
outputs:
TiDB_CLOUD_USER: ${{ env.TIDB_CLOUD_USER }}
TiDB_CLOUD_HOST: ${{ env.TIDB_CLOUD_HOST }}
mysql:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
include:
- os: ubuntu-22.04
cert: /etc/ssl/certs/ca-certificates.crt
- os: macos-12
cert: /etc/ssl/cert.pem
- os: windows-2022
cert: ./example_code/x1.pem
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get mysql
uses: shogo82148/actions-setup-mysql@v1
- name: Run test on ${{ matrix.os }}
run: mysql -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=${{ matrix.cert }} -p${{ secrets.TIDB_CLOUD_PASSWORD }}
no_tls:
needs: setup
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get mysql
uses: shogo82148/actions-setup-mysql@v1
- name: Run test
run: "! mysql -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P 4000 -D test --ssl-mode=DISABLED -p${{ secrets.TIDB_CLOUD_PASSWORD }}"
invalid_tls_version:
needs: setup
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
matrix:
tls: [ TLSv1, TLSv1.1 ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run test on ${{ matrix.tls }}
run: |
# Starting from 8.0.26, TLSv1 & TLSv1.1 are deprecated. From 8.0.28, they are completely removed.
pip3 install mysql-connector-python==8.0.25
cd example_code/python
! python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{secrets.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
valid_tls_version:
needs: setup
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
matrix:
tls: [ TLSv1.2, TLSv1.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run test on ${{ matrix.tls }}
run: |
pip3 install mysql-connector-python
cd example_code/python
python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{secrets.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
mycli:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
include:
- os: ubuntu-22.04
cert: /etc/ssl/certs/ca-certificates.crt
- os: macos-12
cert: /etc/ssl/cert.pem
- os: windows-2022
cert: ./example_code/x1.pem
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install python
uses: actions/setup-python@v3
- name: Install mycli
run: pip3 install mycli
- name: Run test on ${{ matrix.os }}
run:
mycli -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P 4000 -D test --ssl-ca=${{ matrix.cert }} --ssl-verify-server-cert -p${{ secrets.TIDB_CLOUD_PASSWORD}}
java_jdbc:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
- name: Run test on ubuntu or macos
if: ${{ matrix.os != 'windows-2022' }}
run: |
cd example_code/java
javac ConnectTest.java
java -cp mysql-connector-j-8.0.31.jar: ConnectTest ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
- name: Run test on windows
if: ${{ matrix.os == 'windows-2022' }}
# Need to use Chinese semicolon and an extra space before ConnectTest (don't know why)
run: |
cd example_code/java
javac ConnectTest.java
java -cp mysql-connector-j-8.0.31.jar; ConnectTest ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
# https://jira.mariadb.org/browse/CONJ-1023
java_jdbc_mariadb_CONJ-1023:
needs: setup
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
- name: Run test
run: |
cd example_code/java
javac ConnectTestMariaDB.java
java -cp mariadb-java-client-3.0.9.jar: ConnectTestMariaDB ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
python_mysqlclient:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
include:
- os: ubuntu-22.04
cert: /etc/ssl/certs/ca-certificates.crt
- os: macos-12
cert: /etc/ssl/cert.pem
- os: windows-2022
cert: ../x1.pem
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install mysql in macos
if: ${{ matrix.os == 'macos-12' }}
run: |
# https://github.com/Homebrew/homebrew-core/issues/130258
ln -sv $(brew --prefix zlib)/lib/libz.dylib $(brew --prefix)/lib/libzlib.dylib
brew install mysql
export PATH=$PATH:/usr/local/mysql/bin
- name: Run test on ${{ matrix.os }}
run: |
pip3 install mysqlclient
cd example_code/python
python3 ConnectTest_mysqlclient.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python_mysql_connector:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
include:
- os: ubuntu-22.04
cert: /etc/ssl/certs/ca-certificates.crt
- os: macos-12
cert: /etc/ssl/cert.pem
- os: windows-2022
cert: ../x1.pem
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run test on ${{ matrix.os }}
run: |
pip3 install mysql-connector-python
cd example_code/python
python3 ConnectTest_mysql-connector-python.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python_pymysql:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
include:
- os: ubuntu-22.04
cert: /etc/ssl/certs/ca-certificates.crt
- os: macos-12
cert: /etc/ssl/cert.pem
- os: windows-2022
cert: ../x1.pem
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run test on ${{ matrix.os }}
run: |
pip3 install pymysql
cd example_code/python
python3 ConnectTest_pymysql.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python_sqlalchemy:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
include:
- os: ubuntu-22.04
cert: /etc/ssl/certs/ca-certificates.crt
- os: macos-12
cert: /etc/ssl/cert.pem
- os: windows-2022
cert: ../x1.pem
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install mysql in macos
if: ${{ matrix.os == 'macos-12' }}
run: |
# https://github.com/Homebrew/homebrew-core/issues/130258
ln -sv $(brew --prefix zlib)/lib/libz.dylib $(brew --prefix)/lib/libzlib.dylib
brew install mysql
- name: Run test on ${{ matrix.os }}
run: |
pip3 install mysqlclient
pip3 install sqlalchemy
cd example_code/sqlalchemy
python3 ConnectTest.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
go_godriver:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20.0'
- name: Run test on ${{ matrix.os }}
run: |
cd example_code/go
go mod tidy
go run ConnectTest.go ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
go_gorm:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20.0'
- name: Run test on ${{ matrix.os }}
run: |
cd example_code/gorm
go mod tidy
go run ConnectTest.go ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
node_mysql2:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Run test on ${{ matrix.os }}
run: |
cd example_code/node
npm install --save mysql2
node ConnectTest.js ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
node_sequelize:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Run test on ${{ matrix.os }}
run: |
cd example_code/sequelize
npm install --save mysql2
npm install --save sequelize
node ConnectTest.js ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
rust_mysql:
needs: setup
strategy:
matrix:
os: [ windows-2022, macos-12 ] # skip ubuntu-22.04 as it get stuck for unknown reasons
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: moonrepo/setup-rust@v0
- name: Run test on ${{ matrix.os }}
run: |
cd example_code/rust
cargo run ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
ruby_mysql2:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, macos-12 ] # install mysql2 in windows is a little difficult, dismiss it for now
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install mysql on macos
if: ${{ matrix.os == 'macos-12' }}
run: |
brew install mysql
cd example_code/ruby
# https://github.com/Homebrew/homebrew-core/issues/130258
gem install mysql2 -- --with-mysql-dir=$(brew --prefix mysql)
ruby ConnectTest.rb ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
- name: Run test on ubuntu
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
cd example_code/ruby
gem install mysql2
ruby ConnectTest.rb ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
php_mysqli:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
include:
- os: ubuntu-22.04
cert: /etc/ssl/certs/ca-certificates.crt
- os: macos-12
cert: /etc/ssl/cert.pem
- os: windows-2022
cert: ../x1.pem
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
ini-values: extension=php_mysqli.dll
- name: Run test on ${{ matrix.os }}
run: |
cd example_code/php
php ConnectTest.php ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{matrix.cert}}
cpp_libmysqlclient:
needs: setup
strategy:
matrix:
os: [ ubuntu-22.04, macos-12 ]
include:
- os: ubuntu-22.04
cert: /etc/ssl/certs/ca-certificates.crt
- os: macos-12
cert: /etc/ssl/cert.pem
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: rlalik/setup-cpp-compiler@v1.2
- name: Run test on macos
if: ${{ matrix.os == 'macos-12' }}
run: |
brew install mysql
cd example_code/cpp
g++ ConnectTest.cpp -o test -I/usr/local/include/mysql -lmysqlclient
./test ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{matrix.cert}}
- name: Run test on ubuntu
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo apt install -y libmysqlclient-dev
cd example_code/cpp
g++ ConnectTest.cpp -o test -I/usr/include/mysql -lmysqlclient
./test ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{matrix.cert}}