Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build head workflow #1469

Merged
merged 7 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build-head.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build Against Head

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
cancel-in-progress: true

env:
PREFERRED_LTS_VERSION: "23.7"
CLICKHOUSE_TEST_VERSIONS: '["head"]'

extends:
- .github/workflow/build-template.yml

380 changes: 380 additions & 0 deletions .github/workflows/build-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,380 @@
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: "23.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}}
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
Loading
Loading