-
Notifications
You must be signed in to change notification settings - Fork 42
586 lines (533 loc) · 19.4 KB
/
ci.yaml
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
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
name: GlareDB CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: build-ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest-8-cores
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
name: glaredb cache
with:
path: target/debug/glaredb
key: ${{ github.run_id }}
- name: build
run: just build
static-analysis:
name: Lint and Format
runs-on: ubuntu-latest-8-cores
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: clippy
run: just clippy
- name: format
run: just fmt-check
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest-8-cores
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: run tests
run: just unit-tests
python-binding-tests:
name: Python Binding Tests
runs-on: ubuntu-latest-8-cores
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: build python bindings
run: just python build
- name: run python binding tests
run: just python test
nodejs-bindings-tests:
name: Node.js Binding Tests
runs-on: ubuntu-latest-8-cores
needs: ["build"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: build node.js bindings
run: just js build-debug
- name: run node.js binding tests
run: just js test
pg-protocol:
name: PG Protocol Tests
runs-on: ubuntu-latest-8-cores
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: pg protocol test (script)
run: |
PROTOC=`just protoc && just --evaluate PROTOC` ./scripts/protocol-test.sh
- name: pg protocol tests (slt runner)
run: just slt-bin-debug 'pgproto/*'
sql-logic-tests:
name: SQL Logic Tests
runs-on: ubuntu-latest-8-cores
needs: ["build"]
strategy:
matrix:
protocol: ["postgres", "flightsql", "rpc"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: glaredb cache
with:
path: target/debug/glaredb
key: ${{ github.run_id }}
- name: public sql logic tests DEBUG
if: ${{ env.ACTIONS_STEP_DEBUG == 'true' }}
run: |
if [[ "${{ matrix.protocol }}" == "rpc" ]]; then
just rpc-tests
else
just slt-bin-debug --protocol=${{ matrix.protocol }} 'sqllogictests/*'
fi
- name: public sql logic tests
if: ${{ env.ACTIONS_STEP_DEBUG != 'true' }}
run: |
if [[ "${{ matrix.protocol }}" == "rpc" ]]; then
just rpc-tests
else
just slt-bin-debug --protocol=${{ matrix.protocol }} 'sqllogictests/*'
fi
process-integration-tests:
name: Process Integration Tests (pytest)
runs-on: ubuntu-latest-8-cores
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- name: install poetry
uses: snok/install-poetry@v1
- name: install python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: poetry
cache-dependency-path: tests/poetry.lock
- uses: actions/cache@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
name: glaredb cache
with:
path: target/debug/glaredb
key: ${{ github.run_id }}
- uses: actions/cache@v4
name: py cache
with:
path: |
tests/.venv/
key: ${{ runner.os }}-poetry-${{ hashFiles('**/Cargo.lock') }}
- name: setup pytest
run: just pytest-setup
- name: run pytest
run: just pytest
service-integration-tests:
name: Service Integration Tests (SLT)
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == 'GlareDB'
runs-on: ubuntu-latest-8-cores
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: glaredb cache
with:
path: target/debug/glaredb
key: ${{ github.run_id }}
- name: GCP authenticate
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}
- name: setup GCP
uses: google-github-actions/setup-gcloud@v2
- name: prepare testdata
run: ./scripts/prepare-testdata.sh
- name: run tests (slt)
env:
GCP_SERVICE_ACCOUNT_KEY: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}
GCP_PROJECT_ID: glaredb-artifacts
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AZURE_ACCESS_KEY: ${{ secrets.AZURE_ACCESS_KEY }}
AZURE_ACCOUNT: ${{ secrets.AZURE_ACCOUNT }}
MINIO_ACCESS_KEY: glaredb
MINIO_SECRET_KEY: glaredb_test
TEST_BUCKET: glaredb-test-bucket
run: |
# Prepare SLT (BigQuery)
if ./scripts/files-changed-in-branch.sh \
"scripts/prepare-testdata.sh" \
"scripts/create-test-bigquery-db.sh" \
"testdata/sqllogictests_datasources_common/data" \
"testdata/sqllogictests_bigquery/data"
then
export GCP_PROJECT_ID=glaredb-dev-playground
export BIGQUERY_DATASET_ID=$(./scripts/create-test-bigquery-db.sh)
else
export BIGQUERY_DATASET_ID=glaredb_test
fi
# Prepare SLT (Object store)
export GCS_BUCKET_NAME=glaredb-test
export AWS_S3_REGION=us-east-1
export AWS_S3_BUCKET_NAME=glaredb-test
# Unset application default credentials. We don't want to unknowingly
# depend on this.
unset GOOGLE_APPLICATION_CREDENTIALS
# Prepare SLT (Postgres)
POSTGRES_TEST_DB=$(./scripts/create-test-postgres-db.sh)
export POSTGRES_CONN_STRING=$(echo "$POSTGRES_TEST_DB" | sed -n 1p)
export POSTGRES_TUNNEL_SSH_CONN_STRING=$(echo "$POSTGRES_TEST_DB" | sed -n 2p)
# Prepare SLT (MinIO)
./scripts/create-test-minio-store.sh
# Prepare SLT (fake GCS server)
./scripts/create-test-gcs-store.sh
echo "-------------------------------- WITHOUT TUNNEL TEST --------------------------------"
# Run all data source tests without running tunnel tests or the basic
# SLT tests.
just slt-bin --exclude 'sqllogictests/*' \
--exclude '*/tunnels/ssh' \
--exclude 'sqllogictests_snowflake/*' \
--exclude 'sqllogictests_cassandra/*' \
--exclude 'sqllogictests_clickhouse/*' \
--exclude 'sqllogictests_sqlserver/*' \
--exclude 'sqllogictests_mongodb/*' \
--exclude 'sqllogictests_mysql/*' \
echo "-------------------------------- WITH TUNNEL TEST --------------------------------"
# SSH tests are prone to fail if we make a lot of connections at the
# same time. Hence, it makes sense to run all the SSH tests one-by-one
# in order to test the SSH tunnels (which is our aim).
just slt-bin --jobs=1 '*/tunnels/ssh' --exclude 'sqllogictests_mysql/*'
# TODO: move these into the datasource-integration-tests job
echo "-------------------------------- RPC TESTS --------------------------------"
echo "-------------------------- BigQuery -------------------------- "
just slt-bin --protocol=rpc 'sqllogictests_bigquery/*'
echo "-------------------------- Iceberg -------------------------- "
just slt-bin --protocol=rpc 'sqllogictests_iceberg/*'
echo "-------------------------- Native -------------------------- "
just slt-bin --protocol=rpc 'sqllogictests_native/*'
echo "-------------------------- Object Store -------------------------- "
just slt-bin --protocol=rpc 'sqllogictests_object_store/*'
echo "-------------------------- Postgres -------------------------- "
just slt-bin --protocol=rpc --exclude '*/tunnels/ssh' 'sqllogictests_postgres/*'
echo "-------------------------- Fake GCS server with a subdirectory -------------------------- "
just slt-bin -l gs://$TEST_BUCKET/path/to/folder/1 -o service_account_path=/tmp/fake-gcs-creds.json 'sqllogictests_native/*'
just slt-bin -l gs://$TEST_BUCKET/path/to/folder/2 -o service_account_path=/tmp/fake-gcs-creds.json 'sqllogictests_native/*'
minio-integration-tests:
name: MinIO Integration Tests (SLT::MinIO)
runs-on: ubuntu-latest-8-cores
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: glaredb cache
with:
path: target/debug/glaredb
key: ${{ github.run_id }}
- name: run tests (slt)
env:
MINIO_ACCESS_KEY: glaredb
MINIO_SECRET_KEY: glaredb_test
TEST_BUCKET: glaredb-test-bucket
run: |
# prepare testdata
./scripts/prepare-testdata.sh
# Prepare SLT (MinIO)
./scripts/create-test-minio-store.sh
echo "-------------------------- MinIO (S3) -------------------------- "
# PG protocol
just slt-bin --location http://localhost:9100 \
--option access_key_id=$MINIO_ACCESS_KEY \
--option secret_access_key=$MINIO_SECRET_KEY \
--option bucket=$TEST_BUCKET \
'sqllogictests/*' \
'sqllogictests_native/*'
# Flight protocol
just slt-bin --location http://localhost:9100 \
--option access_key_id=$MINIO_ACCESS_KEY \
--option secret_access_key=$MINIO_SECRET_KEY \
--option bucket=$TEST_BUCKET \
'sqllogictests/*' \
'sqllogictests_native/*' \
--protocol=flightsql
echo "-------------------------- MinIO (S3) With a sub-directory -------------------------- "
# PG protocol
just slt-bin -l http://localhost:9100/$TEST_BUCKET/path/to/folder \
-o access_key_id=$MINIO_ACCESS_KEY \
-o secret_access_key=$MINIO_SECRET_KEY \
'sqllogictests/*'
# Flight protocol
just slt-bin -l http://localhost:9100/$TEST_BUCKET/path/to/folder \
-o access_key_id=$MINIO_ACCESS_KEY \
-o secret_access_key=$MINIO_SECRET_KEY \
'sqllogictests/*' \
--protocol=flightsql
datasource-integration-tests:
name: Datasource Integration (${{matrix.settings.name}})
strategy:
matrix:
settings:
- name: Clickhouse
path: "sqllogictests_clickhouse/*"
prepare: |
./scripts/prepare-testdata.sh
source ./scripts/ci-install-clickhouse.sh
export CLICKHOUSE_CONN_STRING=$(./scripts/create-test-clickhouse-db.sh)
- name: Cassandra
path: "sqllogictests_cassandra/*"
prepare: |
export CASSANDRA_CONN_STRING=$(./scripts/create-test-cassandra-db.sh | tail -n 1)
- name: Mysql
path: "sqllogictests_mysql/*"
prepare: |
./scripts/prepare-testdata.sh
export MYSQL_CONN_STRING=$(./scripts/create-test-mysql-db.sh)
export MYSQL_TUNNEL_SSH_CONN_STRING=$(echo "$MYSQL_CONN_STRING" | sed -n 2p)
export MYSQL_CONN_STRING=$(echo "$MYSQL_CONN_STRING" | sed -n 1p)
- name: MongoDB
path: "sqllogictests_mongodb/*"
prepare: |
./scripts/prepare-testdata.sh
export MONGO_CONN_STRING=$(./scripts/create-test-mongo-db.sh)
- name: Sqlserver
path: "sqllogictests_sqlserver/*"
prepare: |
./scripts/prepare-testdata.sh
export SQL_SERVER_CONN_STRING=$(./scripts/create-test-sqlserver-db.sh)
runs-on: ubuntu-latest-8-cores
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: glaredb cache
with:
path: target/debug/glaredb
key: ${{ github.run_id }}
- name: run tests (slt)
run: |
${{matrix.settings.prepare}}
just slt-bin ${{matrix.settings.path}}
just slt-bin --protocol=rpc --exclude '*/tunnels/ssh' ${{matrix.settings.path}}
# Run flight SLTs for everything except clickhouse.
#
# <https://github.com/GlareDB/glaredb/issues/2389>
if [[ "${{ matrix.settings.name }}" != 'Clickhouse' ]]; then
just slt-bin --protocol=flightsql --exclude '*/tunnels/ssh' ${{matrix.settings.path}}
fi
service-integration-tests-snowflake:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == 'GlareDB'
name: Snowflake Service Integration Tests (SLT::Snowflake)
runs-on: ubuntu-latest-8-cores
needs: ["service-integration-tests"]
concurrency:
group: snowflake-integration-tests
cancel-in-progress: false
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache@v4
name: glaredb cache
with:
path: target/debug/glaredb
key: ${{ github.run_id }}
- name: snowflake setup (SnowSQL)
run: |
curl -o snowsql.bash \
https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/snowsql-1.2.24-linux_x86_64.bash
mkdir -p ~/bin
SNOWSQL_DEST=~/bin SNOWSQL_LOGIN_SHELL=~/.profile bash snowsql.bash
- name: prepare testdata
run: ./scripts/prepare-testdata.sh
- name: run tests (slt)
env:
SNOWFLAKE_USERNAME: ${{ secrets.SNOWFLAKE_USERNAME }}
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
run: |
# Prepare SLT (Snowflake)
export PATH="$HOME/bin:$PATH"
if ./scripts/files-changed-in-branch.sh \
"scripts/prepare-testdata.sh" \
"scripts/create-test-snowflake-db.sh" \
"testdata/sqllogictests_datasources_common/data" \
"testdata/sqllogictests_snowflake/data"
then
export SNOWFLAKE_DATABASE=$(./scripts/create-test-snowflake-db.sh)
else
export SNOWFLAKE_DATABASE=glaredb_test
fi
just slt-bin 'sqllogictests_snowflake/*'
just slt-bin --protocol=rpc 'sqllogictests_snowflake/*'