[jdbc] Enhance useragent to indicate Apache Spark #1900
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.6", "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.6", "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.6", "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 |