Skip to content

[repo] Change to Run Examples workflow #2444

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

Merged
merged 7 commits into from
Jun 11, 2025
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
79 changes: 48 additions & 31 deletions .github/workflows/run_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,79 @@ name: Run Examples

on:
workflow_dispatch:

inputs:
ch_version:
description: ClickHouse Version
required: false
default: 24.8
client_version:
description: ClickHouse Java Version
type: choice
options:
- latest
- pre_release
pre_release_version:
description: Client Release Version
required: false
default: 0.9.0

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


jobs:
compile:
run-examples-with-8-jdk-and-latest:
if: github.event.inputs.client_version == 'latest'
runs-on: ubuntu-latest
timeout-minutes: 15
name: Compile (JDK 8)
name: Run Examples With HEAD on JVM 8
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check out PR
- name: Install JDK 11 and Maven
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
cache: "maven"
- name: Install libraries
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 != ''
java -version
mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -DskipITs install
- name: Install JDK 8 and Maven
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: |
8
21
java-version: 8
cache: "maven"
- name: Save Repo Artifacts
id: save-repo-artifacts
uses: actions/cache/save@v4
with:
path: ~/.m2/repository/com/clickhouse
key: ${{ github.run_id }}-ch-artifacts
- name: Build and install libraries
run: mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -Dj8 -DskipITs install
- name: Compile examples
- name: Run Examples
run: |
java -version
docker run -d -q --name demo-service-db -e CLICKHOUSE_USER=default -e CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1 -e CLICKHOUSE_PASSWORD=secret -p 8123:8123 clickhouse/clickhouse-server:${{ github.event.inputs.ch_version }}
cd examples/jdbc
mvn clean compile
echo "Run Id ${{ github.run_id }}"
run-examples:
mvn --batch-mode --no-transfer-progress --show-version clean compile
mvn --no-transfer-progress exec:java -Dexec.mainClass="com.clickhouse.examples.jdbc.Basic" -DchPassword=secret -DfailOnError=true
run-examples-with-8-jdk-and-staging-release:
if: github.event.inputs.client_version == 'pre_release'
runs-on: ubuntu-latest
timeout-minutes: 15
name: Run Examples
needs: compile
name: Run Examples With Pre-Release on JVM 8
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Restore Repo Artifacts
id: restore-repo-artifacts
uses: actions/cache/restore@v4
- name: Install JDK 8 and Maven
uses: actions/setup-java@v4
with:
path: ~/.m2/repository/com/clickhouse
key: ${{ github.run_id }}-ch-artifacts
distribution: "temurin"
java-version: 8
cache: "maven"
- name: Run Examples
run: |
docker run -d --name demo-service-db -e CLICKHOUSE_USER=default -e CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1 -e CLICKHOUSE_PASSWORD=secret -p 8123:8123 clickhouse/clickhouse-server:24.8
java -version
docker run -d -q --name demo-service-db -e CLICKHOUSE_USER=default -e CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1 -e CLICKHOUSE_PASSWORD=secret -p 8123:8123 clickhouse/clickhouse-server:${{ github.event.inputs.ch_version }}
cd examples/jdbc
sed -i "s|<clickhouse-java.version>.*<\/clickhouse-java.version>|<clickhouse-java.version>${{ github.event.inputs.pre_release_version }}<\/clickhouse-java.version>|g" pom.xml
sed -i "s|<url>https:\/\/s01\.oss\.sonatype\.org\/content\/repositories\/snapshots\/<\/url>|<url>https:\/\/s01\.oss\.sonatype\.org\/content\/groups\/staging\/<\/url>|g" pom.xml
mvn --batch-mode --no-transfer-progress --show-version clean compile
mvn exec:java -Dexec.mainClass="com.clickhouse.examples.jdbc.Basic" -DchPassword=secret -DfailOnError=true
mvn --no-transfer-progress exec:java -Dexec.mainClass="com.clickhouse.examples.jdbc.Basic" -DchPassword=secret -DfailOnError=true
9 changes: 8 additions & 1 deletion examples/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

<minJdk>1.8</minJdk>
<clickhouse-packages.classifier>all</clickhouse-packages.classifier>
<slf4j.version>2.0.16</slf4j.version>
</properties>

<dependencies>
Expand All @@ -71,10 +72,16 @@
<classifier>${clickhouse-packages.classifier}</classifier>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.16</version>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
Expand Down
Loading