-
Notifications
You must be signed in to change notification settings - Fork 537
503 lines (490 loc) · 17.5 KB
/
build.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: Build
on:
push:
branches:
- main
paths-ignore:
- "**.md"
- "**/docs/**"
- "**/LICENSE"
- "**/NOTICE"
pull_request:
types:
- opened
- synchronize
- reopened
paths-ignore:
- "**.md"
- "**/docs/**"
- "**/LICENSE"
- "**/NOTICE"
workflow_dispatch:
inputs:
pr:
description: "Pull request#"
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
cancel-in-progress: true
env:
PREFERRED_LTS_VERSION: "24.3"
jobs:
compile:
runs-on: ubuntu-latest
timeout-minutes: 15
name: Compile using JDK 8
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 8 and Maven
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: |
8
21
cache: "maven"
- name: Build and install libraries
run: mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -DclickhouseVersion=$PREFERRED_LTS_VERSION -Dj8 install
- name: Compile examples
run: |
export LIB_VER=$(grep '<revision>' pom.xml | sed -e 's|[[:space:]]*<[/]*revision>[[:space:]]*||g')
find `pwd`/examples -type f -name pom.xml -exec sed -i -e "s|\(<clickhouse-java.version>\).*\(<\)|\1$LIB_VER\2|g" {} \;
for d in $(ls -d `pwd`/examples/*/); do \
if [ -e $d/pom.xml ]; then cd $d && mvn --batch-mode --no-transfer-progress clean compile; fi;
if [ -e $d/gradlew ]; then cd $d && ./gradlew clean build; fi;
done
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports
test-multi-env:
needs: compile
strategy:
matrix:
# https://whichjdk.com/
# https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#selecting-a-java-distribution
# add "corretto", "liberica", "microsoft", "zulu" only when needed
dist: ["temurin"]
# fix issue on "macos-latest", "windows-latest"
os: ["ubuntu-latest"]
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 10
name: ${{ matrix.dist }} JDK 17 on ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 17 and Maven
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.dist }}
java-version: 17
cache: "maven"
- name: Test libraries
run: mvn --batch-mode --no-transfer-progress -Dj8 -DskipITs verify
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports
test-native-image:
runs-on: ubuntu-latest
needs: compile
timeout-minutes: 20
name: Test Native Image
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
version: "latest"
java-version: "17"
components: "native-image"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build native image
run: mvn --batch-mode --no-transfer-progress -Pnative -Dj8 -DskipTests install
- name: Test native image
run: ./clickhouse-jdbc/target/clickhouse-jdbc-bin
- name: Compress binary
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
# https://blogs.oracle.com/javamagazine/post/pedal-to-the-metal-high-performance-java-with-graalvm-native-image
run: |
upx -7 -k ./clickhouse-jdbc/target/clickhouse-jdbc-bin
du -sh clickhouse-jdbc/target/*
- name: Test compressed native image
run: ./clickhouse-jdbc/target/clickhouse-jdbc-bin
test-java-client:
runs-on: ubuntu-latest
needs: compile
strategy:
matrix:
# most recent LTS releases as well as latest stable builds
# https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease
clickhouse: ["23.8", "24.3", "24.8", "latest"]
fail-fast: false
timeout-minutes: 15
name: Java client + CH ${{ matrix.clickhouse }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 17 and Maven
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: |
8
17
cache: "maven"
- name: Setup Toolchain
shell: bash
run: |
mkdir -p $HOME/.m2 \
&& cat << EOF > $HOME/.m2/toolchains.xml
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
</provides>
<configuration>
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
</configuration>
</toolchain>
</toolchains>
EOF
- name: Test Java client
env:
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
run: |
mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client -DclickhouseVersion=${{ matrix.clickhouse }} verify
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports
test-http-client:
runs-on: ubuntu-latest
needs: compile
strategy:
matrix:
# most recent LTS releases as well as latest stable builds
# https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease
clickhouse: ["cloud"]
fail-fast: false
timeout-minutes: 15
name: Java client (http) + CH ${{ matrix.clickhouse }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 17 and Maven
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: |
8
17
21
cache: "maven"
- name: Setup Toolchain
shell: bash
run: |
mkdir -p $HOME/.m2 \
&& cat << EOF > $HOME/.m2/toolchains.xml
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
</provides>
<configuration>
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
</configuration>
</toolchain>
</toolchains>
EOF
- name: Install Java client
run: mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client -DskipTests install
- name: Test http client
env:
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
run: |
mvn --batch-mode --no-transfer-progress --projects clickhouse-http-client -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=http verify
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports
test-jdbc-driver:
runs-on: ubuntu-latest
needs: compile
strategy:
matrix:
clickhouse: ["23.8", "24.3", "24.6", "latest", "cloud"]
# here http, http_client and apache_http_client represent different value of http_connection_provider
protocol: ["http", "http_client", "apache_http_client"]
fail-fast: false
timeout-minutes: 15
name: JDBC driver + CH ${{ matrix.clickhouse }} (${{ matrix.protocol }})
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 17 and Maven
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: |
8
17
cache: "maven"
- name: Setup Toolchain
shell: bash
run: |
mkdir -p $HOME/.m2 \
&& cat << EOF > $HOME/.m2/toolchains.xml
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
</provides>
<configuration>
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
</configuration>
</toolchain>
</toolchains>
EOF
- name: Install Java client
run: mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client -DskipTests install
- name: Test JDBC driver
env:
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
run: |
mvn --batch-mode --no-transfer-progress --projects clickhouse-jdbc -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=${{ matrix.protocol }} verify
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports
test-r2dbc-driver:
runs-on: ubuntu-latest
needs: compile
strategy:
matrix:
clickhouse: ["23.8", "24.3", "24.8", "latest"]
# grpc is not fully supported, and http_client and apache_http_client do not work in CI environment(due to limited threads?)
protocol: ["http"]
r2dbc: ["1.0.0.RELEASE", "0.9.1.RELEASE"]
fail-fast: false
timeout-minutes: 10
name: R2DBC ${{ matrix.r2dbc }} + CH ${{ matrix.clickhouse }} (${{ matrix.protocol }})
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 17 and Maven
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: |
8
17
cache: "maven"
- name: Setup Toolchain
shell: bash
run: |
mkdir -p $HOME/.m2 \
&& cat << EOF > $HOME/.m2/toolchains.xml
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
</provides>
<configuration>
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
</configuration>
</toolchain>
</toolchains>
EOF
- name: Install Java client
run: mvn --also-make --no-transfer-progress --batch-mode --projects clickhouse-jdbc -DskipTests install
- name: Test R2DBC ${{ matrix.r2dbc }}
run: |
mvn --batch-mode --no-transfer-progress --projects clickhouse-r2dbc -DclickhouseVersion=${{ matrix.clickhouse }} \
-D'r2dbc-spi.version=${{ matrix.r2dbc }}' -Dprotocol=${{ matrix.protocol }} verify
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports
test-timezone-support:
runs-on: ubuntu-latest
needs: compile
strategy:
matrix:
serverTz:
[
"Asia/Chongqing",
"America/Los_Angeles",
"Etc/UTC",
"Europe/Berlin",
"Europe/Moscow",
]
clientTz:
[
"Asia/Chongqing",
"America/Los_Angeles",
"Etc/UTC",
"Europe/Berlin",
"Europe/Moscow",
]
fail-fast: false
timeout-minutes: 20
name: "TimeZone(C/S): ${{ matrix.clientTz }} vs. ${{ matrix.serverTz }}"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 8 and Maven
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 8
cache: "maven"
- name: Install Java client
run: mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client -Dj8 -DskipTests install
- name: Test JDBC and R2DBC drivers
run: |
mvn --batch-mode --no-transfer-progress --projects clickhouse-jdbc,clickhouse-r2dbc -DclickhouseVersion=$PREFERRED_LTS_VERSION \
-DclickhouseTimezone=${{ matrix.serverTz }} -Duser.timezone=${{ matrix.clientTz }} \
-Dj8 -DskipUTs verify
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports
test-client-v2:
runs-on: ubuntu-latest
needs: compile
strategy:
matrix:
# most recent LTS releases as well as latest stable builds
# https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease
clickhouse: ["24.3", "24.8", "latest"]
fail-fast: false
timeout-minutes: 15
name: Client V2 + CH ${{ matrix.clickhouse }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
if: github.event.inputs.pr != ''
- name: Install JDK 17 and Maven
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: |
8
17
cache: "maven"
- name: Setup Toolchain
shell: bash
run: |
mkdir -p $HOME/.m2 \
&& cat << EOF > $HOME/.m2/toolchains.xml
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
</provides>
<configuration>
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
</configuration>
</toolchain>
</toolchains>
EOF
- name: Test Java client
run: |
mvn --also-make --batch-mode --no-transfer-progress --projects client-v2 -Dclient.tests.useNewImplementation=true -DclickhouseVersion=${{ matrix.clickhouse }} verify
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports