Skip to content

Commit 7eeec3d

Browse files
author
mzitnik
committed
Add build head workflow
1 parent d384444 commit 7eeec3d

File tree

1 file changed

+382
-0
lines changed

1 file changed

+382
-0
lines changed

.github/workflows/build-head.yml

Lines changed: 382 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,382 @@
1+
name: Build Against Head
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
10+
cancel-in-progress: true
11+
12+
env:
13+
PREFERRED_LTS_VERSION: "23.7"
14+
15+
jobs:
16+
compile:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 15
19+
name: Compile using JDK 8
20+
steps:
21+
- name: Check out repository
22+
uses: actions/checkout@v3
23+
- name: Check out PR
24+
run: |
25+
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
26+
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
27+
if: github.event.inputs.pr != ''
28+
- name: Install JDK 8 and Maven
29+
uses: actions/setup-java@v3
30+
with:
31+
distribution: "temurin"
32+
java-version: 8
33+
cache: "maven"
34+
- name: Build and install libraries
35+
run: mvn --batch-mode --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -DclickhouseVersion=$PREFERRED_LTS_VERSION -Dj8 install
36+
- name: Compile examples
37+
run: |
38+
export LIB_VER=$(grep '<revision>' pom.xml | sed -e 's|[[:space:]]*<[/]*revision>[[:space:]]*||g')
39+
find `pwd`/examples -type f -name pom.xml -exec sed -i -e "s|\(<clickhouse-java.version>\).*\(<\)|\1$LIB_VER\2|g" {} \;
40+
for d in $(ls -d `pwd`/examples/*/); do cd $d && mvn clean compile; done
41+
42+
test-multi-env:
43+
needs: compile
44+
strategy:
45+
matrix:
46+
# https://whichjdk.com/
47+
# https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#selecting-a-java-distribution
48+
# add "corretto", "liberica", "microsoft", "zulu" only when needed
49+
dist: ["temurin"]
50+
# fix issue on "macos-latest", "windows-latest"
51+
os: ["ubuntu-latest"]
52+
fail-fast: false
53+
runs-on: ${{ matrix.os }}
54+
timeout-minutes: 10
55+
name: ${{ matrix.dist }} JDK 17 on ${{ matrix.os }}
56+
steps:
57+
- name: Check out repository
58+
uses: actions/checkout@v3
59+
- name: Check out PR
60+
run: |
61+
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
62+
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
63+
if: github.event.inputs.pr != ''
64+
- name: Install JDK 17 and Maven
65+
uses: actions/setup-java@v3
66+
with:
67+
distribution: ${{ matrix.dist }}
68+
java-version: 17
69+
cache: "maven"
70+
- name: Test libraries
71+
run: mvn --batch-mode -Dj8 -DskipITs verify
72+
- name: Upload test results
73+
uses: actions/upload-artifact@v2
74+
if: failure()
75+
with:
76+
name: result ${{ github.job }}
77+
path: |
78+
**/target/failsafe-reports
79+
**/target/surefire-reports
80+
81+
test-native-image:
82+
runs-on: ubuntu-latest
83+
needs: compile
84+
timeout-minutes: 20
85+
name: Test Native Image
86+
steps:
87+
- name: Check out repository
88+
uses: actions/checkout@v3
89+
- name: Check out PR
90+
run: |
91+
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
92+
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
93+
if: github.event.inputs.pr != ''
94+
- name: Setup GraalVM
95+
uses: graalvm/setup-graalvm@v1
96+
with:
97+
version: "latest"
98+
java-version: "17"
99+
components: "native-image"
100+
github-token: ${{ secrets.GITHUB_TOKEN }}
101+
- name: Build native image
102+
run: mvn --batch-mode -Pnative -Dj8 -DskipTests install
103+
- name: Test native image
104+
run: ./clickhouse-jdbc/target/clickhouse-jdbc-bin
105+
- name: Compress binary
106+
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
107+
# https://blogs.oracle.com/javamagazine/post/pedal-to-the-metal-high-performance-java-with-graalvm-native-image
108+
run: |
109+
upx -7 -k ./clickhouse-jdbc/target/clickhouse-jdbc-bin
110+
du -sh clickhouse-jdbc/target/*
111+
- name: Test compressed native image
112+
run: ./clickhouse-jdbc/target/clickhouse-jdbc-bin
113+
114+
test-cli-client:
115+
runs-on: ubuntu-latest
116+
needs: compile
117+
timeout-minutes: 10
118+
name: CLI client + CH LTS
119+
steps:
120+
- name: Check out repository
121+
uses: actions/checkout@v3
122+
- name: Check out PR
123+
run: |
124+
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
125+
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
126+
if: github.event.inputs.pr != ''
127+
- name: Install JDK 8 and Maven
128+
uses: actions/setup-java@v3
129+
with:
130+
distribution: "temurin"
131+
java-version: 8
132+
cache: "maven"
133+
- name: Install ClickHouse native command line
134+
run: |
135+
sudo apt-get update \
136+
&& sudo apt-get install -y apt-transport-https ca-certificates dirmngr \
137+
&& sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 \
138+
&& echo "deb https://packages.clickhouse.com/deb lts main" | sudo tee /etc/apt/sources.list.d/clickhouse.list \
139+
&& sudo apt-get update && sudo apt-get install -y clickhouse-client \
140+
&& clickhouse client --version
141+
- name: Test CLI client
142+
run: |
143+
mvn --also-make --batch-mode --projects clickhouse-cli-client -DclickhouseVersion=$PREFERRED_LTS_VERSION -Dj8 -DskipUTs verify
144+
- name: Upload test results
145+
uses: actions/upload-artifact@v2
146+
if: failure()
147+
with:
148+
name: result ${{ github.job }}
149+
path: |
150+
**/target/failsafe-reports
151+
**/target/surefire-reports
152+
153+
test-java-client:
154+
runs-on: ubuntu-latest
155+
needs: compile
156+
strategy:
157+
matrix:
158+
# Run against ClickHouse head
159+
# https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease
160+
clickhouse: ["head"]
161+
fail-fast: false
162+
timeout-minutes: 15
163+
name: Java client + CH ${{ matrix.clickhouse }}
164+
steps:
165+
- name: Check out repository
166+
uses: actions/checkout@v3
167+
- name: Check out PR
168+
run: |
169+
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
170+
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
171+
if: github.event.inputs.pr != ''
172+
- name: Install JDK 17 and Maven
173+
uses: actions/setup-java@v3
174+
with:
175+
distribution: "temurin"
176+
java-version: |
177+
8
178+
17
179+
cache: "maven"
180+
- name: Setup Toolchain
181+
shell: bash
182+
run: |
183+
mkdir -p $HOME/.m2 \
184+
&& cat << EOF > $HOME/.m2/toolchains.xml
185+
<?xml version="1.0" encoding="UTF8"?>
186+
<toolchains>
187+
<toolchain>
188+
<type>jdk</type>
189+
<provides>
190+
<version>17</version>
191+
</provides>
192+
<configuration>
193+
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
194+
</configuration>
195+
</toolchain>
196+
</toolchains>
197+
EOF
198+
- name: Test Java client
199+
run: |
200+
mvn --also-make --batch-mode --projects clickhouse-cli-client,clickhouse-grpc-client,clickhouse-http-client -DclickhouseVersion=${{ matrix.clickhouse }} verify
201+
- name: Upload test results
202+
uses: actions/upload-artifact@v2
203+
if: failure()
204+
with:
205+
name: result ${{ github.job }}
206+
path: |
207+
**/target/failsafe-reports
208+
**/target/surefire-reports
209+
210+
test-jdbc-driver:
211+
runs-on: ubuntu-latest
212+
needs: compile
213+
strategy:
214+
matrix:
215+
clickhouse: ["head"]
216+
# here http, http_client and apache_http_client represent different value of http_connection_provider
217+
protocol: ["http", "http_client", "apache_http_client", "grpc"]
218+
fail-fast: false
219+
timeout-minutes: 15
220+
name: JDBC driver + CH ${{ matrix.clickhouse }} (${{ matrix.protocol }})
221+
steps:
222+
- name: Check out repository
223+
uses: actions/checkout@v3
224+
- name: Check out PR
225+
run: |
226+
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
227+
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
228+
if: github.event.inputs.pr != ''
229+
- name: Install JDK 17 and Maven
230+
uses: actions/setup-java@v3
231+
with:
232+
distribution: "temurin"
233+
java-version: |
234+
8
235+
17
236+
cache: "maven"
237+
- name: Setup Toolchain
238+
shell: bash
239+
run: |
240+
mkdir -p $HOME/.m2 \
241+
&& cat << EOF > $HOME/.m2/toolchains.xml
242+
<?xml version="1.0" encoding="UTF8"?>
243+
<toolchains>
244+
<toolchain>
245+
<type>jdk</type>
246+
<provides>
247+
<version>17</version>
248+
</provides>
249+
<configuration>
250+
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
251+
</configuration>
252+
</toolchain>
253+
</toolchains>
254+
EOF
255+
- name: Install Java client
256+
run: mvn --also-make --batch-mode --projects clickhouse-cli-client,clickhouse-grpc-client,clickhouse-http-client -DskipTests install
257+
- name: Test JDBC driver
258+
run: |
259+
mvn --batch-mode --projects clickhouse-jdbc -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=${{ matrix.protocol }} verify
260+
- name: Upload test results
261+
uses: actions/upload-artifact@v2
262+
if: failure()
263+
with:
264+
name: result ${{ github.job }}
265+
path: |
266+
**/target/failsafe-reports
267+
**/target/surefire-reports
268+
269+
test-r2dbc-driver:
270+
runs-on: ubuntu-latest
271+
needs: compile
272+
strategy:
273+
matrix:
274+
clickhouse: ["head"]
275+
# grpc is not fully supported, and http_client and apache_http_client do not work in CI environment(due to limited threads?)
276+
protocol: ["http"]
277+
r2dbc: ["1.0.0.RELEASE", "0.9.1.RELEASE"]
278+
fail-fast: false
279+
timeout-minutes: 10
280+
name: R2DBC ${{ matrix.r2dbc }} + CH ${{ matrix.clickhouse }} (${{ matrix.protocol }})
281+
steps:
282+
- name: Check out repository
283+
uses: actions/checkout@v3
284+
- name: Check out PR
285+
run: |
286+
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
287+
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
288+
if: github.event.inputs.pr != ''
289+
- name: Install JDK 17 and Maven
290+
uses: actions/setup-java@v3
291+
with:
292+
distribution: "temurin"
293+
java-version: |
294+
8
295+
17
296+
cache: "maven"
297+
- name: Setup Toolchain
298+
shell: bash
299+
run: |
300+
mkdir -p $HOME/.m2 \
301+
&& cat << EOF > $HOME/.m2/toolchains.xml
302+
<?xml version="1.0" encoding="UTF8"?>
303+
<toolchains>
304+
<toolchain>
305+
<type>jdk</type>
306+
<provides>
307+
<version>17</version>
308+
</provides>
309+
<configuration>
310+
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
311+
</configuration>
312+
</toolchain>
313+
</toolchains>
314+
EOF
315+
- name: Install Java client
316+
run: mvn --also-make --batch-mode --projects clickhouse-jdbc -DskipTests install
317+
- name: Test R2DBC ${{ matrix.r2dbc }}
318+
run: |
319+
mvn --batch-mode --projects clickhouse-r2dbc -DclickhouseVersion=${{ matrix.clickhouse }} \
320+
-D'r2dbc-spi.version=${{ matrix.r2dbc }}' -Dprotocol=${{ matrix.protocol }} verify
321+
- name: Upload test results
322+
uses: actions/upload-artifact@v2
323+
if: failure()
324+
with:
325+
name: result ${{ github.job }}
326+
path: |
327+
**/target/failsafe-reports
328+
**/target/surefire-reports
329+
330+
test-timezone-support:
331+
runs-on: ubuntu-latest
332+
needs: compile
333+
strategy:
334+
matrix:
335+
serverTz:
336+
[
337+
"Asia/Chongqing",
338+
"America/Los_Angeles",
339+
"Etc/UTC",
340+
"Europe/Berlin",
341+
"Europe/Moscow",
342+
]
343+
clientTz:
344+
[
345+
"Asia/Chongqing",
346+
"America/Los_Angeles",
347+
"Etc/UTC",
348+
"Europe/Berlin",
349+
"Europe/Moscow",
350+
]
351+
fail-fast: false
352+
timeout-minutes: 20
353+
name: "TimeZone(C/S): ${{ matrix.clientTz }} vs. ${{ matrix.serverTz }}"
354+
steps:
355+
- name: Check out repository
356+
uses: actions/checkout@v3
357+
- name: Check out PR
358+
run: |
359+
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
360+
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
361+
if: github.event.inputs.pr != ''
362+
- name: Install JDK 8 and Maven
363+
uses: actions/setup-java@v3
364+
with:
365+
distribution: "temurin"
366+
java-version: 8
367+
cache: "maven"
368+
- name: Install Java client
369+
run: mvn --also-make --batch-mode --projects clickhouse-cli-client,clickhouse-grpc-client,clickhouse-http-client -Dj8 -DskipTests install
370+
- name: Test JDBC and R2DBC drivers
371+
run: |
372+
mvn --batch-mode --projects clickhouse-jdbc,clickhouse-r2dbc -DclickhouseVersion=$PREFERRED_LTS_VERSION \
373+
-DclickhouseTimezone=${{ matrix.serverTz }} -Duser.timezone=${{ matrix.clientTz }} \
374+
-Dj8 -DskipUTs verify
375+
- name: Upload test results
376+
uses: actions/upload-artifact@v2
377+
if: failure()
378+
with:
379+
name: result ${{ github.job }}
380+
path: |
381+
**/target/failsafe-reports
382+
**/target/surefire-reports

0 commit comments

Comments
 (0)