forked from duckdb/duckdb-postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
476 lines (419 loc) · 13.3 KB
/
Copy pathIntegrationTests.yml
File metadata and controls
476 lines (419 loc) · 13.3 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
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
name: Integration Tests
on:
push:
paths-ignore:
- '**.md'
- '.github/workflows/**'
- '!.github/workflows/IntegrationTests.yml'
pull_request:
repository_dispatch:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
cancel-in-progress: true
jobs:
format-check:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Install
run: |
pip3 install \
black==25.1.0 \
clang_format==11.0.1 \
cmake-format==0.6.13
- name: Format Check
run: |
python -m pip show black
python -m pip show cmake_format
python -m pip show clang_format
clang-format --version
clang-format --dump-config
make format-check
linux-tests:
name: Linux (pg-17)
needs: format-check
runs-on: ubuntu-latest
env:
GEN: ninja
CC: 'ccache gcc'
CXX: 'ccache g++'
CCACHE_DIR: ${{ github.workspace }}/ccache
VCPKG_TARGET_TRIPLET: x64-linux-release
VCPKG_HOST_TRIPLET: x64-linux-release
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: 'true'
- name: Install Dependencies
run: |
sudo apt-get update -y -q -o=Dpkg::Use-Pty=0
sudo apt-get install -y -q -o=Dpkg::Use-Pty=0 \
build-essential \
ccache \
cmake \
ninja-build
- name: Cache Key
id: cache_key
working-directory: ./duckdb
run: |
DUCKDB_VERSION=$(git rev-parse --short=10 HEAD)
KEY="${{ runner.os }}-${{ runner.arch }}-$DUCKDB_VERSION"
echo "value=${KEY}" >> "${GITHUB_OUTPUT}"
- name: Restore Cache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/ccache
key: ${{ steps.cache_key.outputs.value }}
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11.1
with:
vcpkgGitCommitId: 84bab45d415d22042bd0b9081aea57f362da3f35
- name: Build extension
run: |
make release
- name: Save Cache
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}/ccache
key: ${{ steps.cache_key.outputs.value }}
- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v8
with:
postgres-version: 17
username: 'postgres'
password: 'postgres'
database: 'postgres'
port: '5432'
- name: Run tests
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
POSTGRES_TEST_DATABASE_AVAILABLE: 1
LOCAL_EXTENSION_REPO: 'build/release/repository'
run: |
source ./create-postgres-tables.sh
psql -d postgresscanner -c "SELECT 42"
./build/release/test/unittest 'test/sql/*'
linux-pgbouncer:
name: Linux PgBouncer (${{ matrix.postgres.name }})
needs: linux-tests
runs-on: ubuntu-latest
strategy:
matrix:
postgres:
- name: pg-14
version: 14
- name: pg-18
version: 18
env:
GEN: ninja
CC: 'ccache gcc'
CXX: 'ccache g++'
CCACHE_DIR: ${{ github.workspace }}/ccache
VCPKG_TARGET_TRIPLET: x64-linux-release
VCPKG_HOST_TRIPLET: x64-linux-release
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: 'true'
- name: Install Dependencies
run: |
sudo apt-get update -y -q -o=Dpkg::Use-Pty=0
sudo apt-get install -y -q -o=Dpkg::Use-Pty=0 \
build-essential \
ccache \
cmake \
ninja-build \
pgbouncer
- name: Cache Key
id: cache_key
working-directory: ./duckdb
run: |
DUCKDB_VERSION=$(git rev-parse --short=10 HEAD)
KEY="${{ runner.os }}-${{ runner.arch }}-$DUCKDB_VERSION"
echo "value=${KEY}" >> "${GITHUB_OUTPUT}"
- name: Restore Cache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/ccache
key: ${{ steps.cache_key.outputs.value }}
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11.1
with:
vcpkgGitCommitId: 84bab45d415d22042bd0b9081aea57f362da3f35
- name: Build extension
run: |
make release
- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v8
with:
postgres-version: ${{ matrix.postgres.version }}
username: 'postgres'
password: 'postgres'
database: 'postgres'
port: '5432'
ssl: true
- name: Setup PgBouncer
run: |
mkdir pgbouncer
openssl req -new -x509 -days 365 -nodes -text -subj "/CN=localhost" \
-out ./pgbouncer/pgbouncer.crt \
-keyout ./pgbouncer/pgbouncer.key
sudo chown -R postgres:postgres ./pgbouncer
sudo cp -p ./pgbouncer/* /etc/pgbouncer/
sudo ls -la /etc/pgbouncer
sudo sed -i 's|^;bardb = host=localhost dbname=bazdb|postgresscanner = host=localhost dbname=postgresscanner|' /etc/pgbouncer/pgbouncer.ini
sudo sed -i 's|^;pool_mode = session|pool_mode = transaction|' /etc/pgbouncer/pgbouncer.ini
sudo sed -i 's|^;max_prepared_statements = 0|max_prepared_statements = 1024|' /etc/pgbouncer/pgbouncer.ini
sudo sed -i 's|^;client_tls_sslmode = disable|client_tls_sslmode = require|' /etc/pgbouncer/pgbouncer.ini
sudo sed -i 's|^;client_tls_key_file =|client_tls_key_file = /etc/pgbouncer/pgbouncer.key|' /etc/pgbouncer/pgbouncer.ini
sudo sed -i 's|^;client_tls_cert_file =|client_tls_cert_file = /etc/pgbouncer/pgbouncer.crt|' /etc/pgbouncer/pgbouncer.ini
echo '"postgres" "postgres"' | sudo tee /etc/pgbouncer/userlist.txt
sudo cat /etc/pgbouncer/pgbouncer.ini
sudo systemctl restart pgbouncer
- name: Setup test data
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
run: |
source ./create-postgres-tables.sh
- name: Run tests with PgBouncer
env:
PGHOST: localhost
PGPORT: 6432
PGUSER: postgres
PGPASSWORD: postgres
PGSSLMODE: require
POSTGRES_TEST_DATABASE_AVAILABLE: 1
LOCAL_EXTENSION_REPO: 'build/release/repository'
run: |
psql -d postgresscanner -c "SELECT * FROM pg_stat_ssl WHERE pid = pg_backend_pid()"
./build/release/test/unittest 'test/sql/*'
- name: Run tests directly
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGSSLMODE: require
POSTGRES_TEST_DATABASE_AVAILABLE: 1
LOCAL_EXTENSION_REPO: 'build/release/repository'
run: |
psql -d postgresscanner -c "SELECT * FROM pg_stat_ssl WHERE pid = pg_backend_pid()"
./build/release/test/unittest 'test/sql/*'
- name: Upload log
if: always()
uses: actions/upload-artifact@v7
with:
name: pgbouncer_${{ matrix.pg_version }}_log
path: |
/var/log/postgresql/pgbouncer.log
linux-sanitized:
name: Linux ${{ matrix.sanitizer.name }} (pg-17)
needs: linux-tests
runs-on: ubuntu-latest
strategy:
matrix:
sanitizer:
- name: ASan
threadsan_enabled: 0
- name: TSan
threadsan_enabled: 1
env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
CC: 'ccache gcc'
CXX: 'ccache g++'
CCACHE_DIR: ${{ github.workspace }}/ccache
VCPKG_TARGET_TRIPLET: x64-linux-release
VCPKG_HOST_TRIPLET: x64-linux-release
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: 'true'
- name: Install Dependencies
run: |
sudo apt-get update -y -q -o=Dpkg::Use-Pty=0
sudo apt-get install -y -q -o=Dpkg::Use-Pty=0 \
build-essential \
ccache \
cmake \
mold \
ninja-build
- name: Cache Key
id: cache_key
working-directory: ./duckdb
run: |
DUCKDB_VERSION=$(git rev-parse --short=10 HEAD)
KEY="${{ runner.os }}-${{ runner.arch }}-$DUCKDB_VERSION"-relassert-${{ matrix.threadsan }}
echo "value=${KEY}" >> "${GITHUB_OUTPUT}"
- name: Restore Cache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/ccache
key: ${{ steps.cache_key.outputs.value }}
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11.1
with:
vcpkgGitCommitId: 84bab45d415d22042bd0b9081aea57f362da3f35
- name: Build extension
env:
THREADSAN: ${{ matrix.sanitizer.threadsan_enabled }}
run: |
make relassert
cat ./build/relassert/src/CMakeFiles/duckdb.dir/flags.make
cd build
ln -s relassert release
- name: Save Cache
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}/ccache
key: ${{ steps.cache_key.outputs.value }}
- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v8
with:
postgres-version: 17
username: 'postgres'
password: 'postgres'
database: 'postgres'
port: '5432'
ssl: true
- name: Run tests
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGSSLMODE: require
POSTGRES_TEST_DATABASE_AVAILABLE: 1
LOCAL_EXTENSION_REPO: 'build/relassert/repository'
run: |
source ./create-postgres-tables.sh
psql -d postgresscanner -c "SELECT * FROM pg_stat_ssl WHERE pid = pg_backend_pid()"
./build/relassert/test/unittest
windows-tests:
name: Windows (pg-17)
needs: linux-tests
runs-on: windows-latest
env:
GEN: ninja
CC: 'ccache cl'
CXX: 'ccache cl'
CCACHE_DIR: ${{ github.workspace }}/ccache
VCPKG_TARGET_TRIPLET: x64-windows-static-release
VCPKG_HOST_TRIPLET: x64-windows-static-release
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: 'true'
- name: Dependencies
shell: bash
run: |
choco install \
ccache \
make \
ninja \
-y --force --no-progress
- name: Build Environment
shell: bash
run: |
# bash from Git
echo 'C:/Program Files/Git/bin' >> "${GITHUB_PATH}"
# make, ninja and ccache from Chocolatey
echo 'C:/ProgramData/Chocolatey/bin' >> "${GITHUB_PATH}"
- name: Build Environment Check
shell: cmd
run: |
where bash
bash --version
where make
make --version
where ninja
ninja --version
where ccache
ccache --version
echo %PATH%
- name: Cache Key
id: cache_key
working-directory: ./duckdb
shell: bash
run: |
DUCKDB_VERSION=$(git rev-parse --short=10 HEAD)
KEY="${{ runner.os }}-${{ runner.arch }}-$DUCKDB_VERSION"
echo "value=${KEY}" >> "${GITHUB_OUTPUT}"
- name: Restore Cache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/ccache
key: ${{ steps.cache_key.outputs.value }}
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11.1
with:
vcpkgGitCommitId: 84bab45d415d22042bd0b9081aea57f362da3f35
- name: Prepare build tree
shell: bash
working-directory: duckdb
run: |
patch -p1 < ../scripts/win_resources.patch
- name: Build extension
shell: cmd
run: |
mv "C:\Program Files\Git\usr\bin\link.exe" "C:\Program Files\Git\usr\bin\link-git.exe"
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
bash -c "make release"
- name: Save Cache
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}/ccache
key: ${{ steps.cache_key.outputs.value }}
- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v8
with:
postgres-version: '17'
username: 'postgres'
password: 'postgres'
database: 'postgres'
port: '5432'
ssl: true
- name: Setup test data
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGSCANNERTMP_ABS_DIR_PREFIX: ${{ github.workspace }}
shell: bash
run: |
source ./create-postgres-tables.sh
- name: Run tests
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGSSLMODE: require
POSTGRES_TEST_DATABASE_AVAILABLE: 1
LOCAL_EXTENSION_REPO: 'build/release/repository'
shell: bash
run: |
psql -d postgresscanner -c "SELECT * FROM pg_stat_ssl WHERE pid = pg_backend_pid()"
./build/release/test/unittest