Skip to content

Adding cloud tests #772

Adding cloud tests

Adding cloud tests #772

name: Build Template
on: [push, pull_request, workflow_dispatch, schedule]
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
cancel-in-progress: true
env:
PREFERRED_LTS_VERSION: "24.3"
CLICKHOUSE_TEST_VERSIONS: "[]"
jobs:
compile:
runs-on: ubuntu-latest
timeout-minutes: 15
name: Compile using JDK 8
steps:
- name: Check out repository
uses: actions/checkout@v3
- 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@v3
with:
distribution: "temurin"
java-version: 8
cache: "maven"
- name: Build and install libraries
run: mvn --batch-mode --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 cd $d && mvn clean compile; done
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@v3
- 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@v3
with:
distribution: ${{ matrix.dist }}
java-version: 17
cache: "maven"
- name: Test libraries
run: mvn --batch-mode -Dj8 -DskipITs verify
- name: Upload test results
uses: actions/upload-artifact@v2
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@v3
- 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 -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-cli-client:
runs-on: ubuntu-latest
needs: compile
timeout-minutes: 10
name: CLI client + CH LTS
steps:
- name: Check out repository
uses: actions/checkout@v3
- 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@v3
with:
distribution: "temurin"
java-version: 8
cache: "maven"
- name: Install ClickHouse native command line
run: |
sudo apt-get update \
&& sudo apt-get install -y apt-transport-https ca-certificates dirmngr \
&& sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 \
&& echo "deb https://packages.clickhouse.com/deb lts main" | sudo tee /etc/apt/sources.list.d/clickhouse.list \
&& sudo apt-get update && sudo apt-get install -y clickhouse-client \
&& clickhouse client --version
- name: Test CLI client
run: |
mvn --also-make --batch-mode --projects clickhouse-cli-client -DclickhouseVersion=$PREFERRED_LTS_VERSION -Dj8 -DskipUTs verify
- name: Upload test results
uses: actions/upload-artifact@v2
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports
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: ${{CLICKHOUSE_TEST_VERSIONS}}

Check failure on line 158 in .github/workflows/build-template.yml

View workflow run for this annotation

GitHub Actions / Build Template

Invalid workflow file

The workflow is not valid. .github/workflows/build-template.yml (Line: 158, Col: 21): Unrecognized named-value: 'CLICKHOUSE_TEST_VERSIONS'. Located at position 1 within expression: CLICKHOUSE_TEST_VERSIONS .github/workflows/build-template.yml (Line: 158, Col: 21): Unexpected value '${{CLICKHOUSE_TEST_VERSIONS}}'
fail-fast: false
timeout-minutes: 15
name: Java client + CH ${{ matrix.clickhouse }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- 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@v3
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 --projects clickhouse-cli-client,clickhouse-grpc-client,clickhouse-http-client -DclickhouseVersion=${{ matrix.clickhouse }} verify
- name: Upload test results
uses: actions/upload-artifact@v2
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: ${{CLICKHOUSE_TEST_VERSIONS}}
# here http, http_client and apache_http_client represent different value of http_connection_provider
protocol: ["http", "http_client", "apache_http_client", "grpc"]
fail-fast: false
timeout-minutes: 15
name: JDBC driver + CH ${{ matrix.clickhouse }} (${{ matrix.protocol }})
steps:
- name: Check out repository
uses: actions/checkout@v3
- 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@v3
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 --projects clickhouse-cli-client,clickhouse-grpc-client,clickhouse-http-client -DskipTests install
- name: Test JDBC driver
run: |
mvn --batch-mode --projects clickhouse-jdbc -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=${{ matrix.protocol }} verify
- name: Upload test results
uses: actions/upload-artifact@v2
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: ${{CLICKHOUSE_TEST_VERSIONS}}
# 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@v3
- 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@v3
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 --projects clickhouse-jdbc -DskipTests install
- name: Test R2DBC ${{ matrix.r2dbc }}
run: |
mvn --batch-mode --projects clickhouse-r2dbc -DclickhouseVersion=${{ matrix.clickhouse }} \
-D'r2dbc-spi.version=${{ matrix.r2dbc }}' -Dprotocol=${{ matrix.protocol }} verify
- name: Upload test results
uses: actions/upload-artifact@v2
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@v3
- 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@v3
with:
distribution: "temurin"
java-version: 8
cache: "maven"
- name: Install Java client
run: mvn --also-make --batch-mode --projects clickhouse-cli-client,clickhouse-grpc-client,clickhouse-http-client -Dj8 -DskipTests install
- name: Test JDBC and R2DBC drivers
run: |
mvn --batch-mode --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@v2
if: failure()
with:
name: result ${{ github.job }}
path: |
**/target/failsafe-reports
**/target/surefire-reports