Skip to content

Commit d1c50b8

Browse files
authored
Merge pull request #2444 from ClickHouse/upd_run_examples_wf
[repo] Change to Run Examples workflow
2 parents e1e7e1d + a122ec9 commit d1c50b8

File tree

2 files changed

+56
-32
lines changed

2 files changed

+56
-32
lines changed

.github/workflows/run_examples.yml

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,79 @@ name: Run Examples
22

33
on:
44
workflow_dispatch:
5-
5+
inputs:
6+
ch_version:
7+
description: ClickHouse Version
8+
required: false
9+
default: 24.8
10+
client_version:
11+
description: ClickHouse Java Version
12+
type: choice
13+
options:
14+
- latest
15+
- pre_release
16+
pre_release_version:
17+
description: Client Release Version
18+
required: false
19+
default: 0.9.0
20+
621
concurrency:
722
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
823
cancel-in-progress: true
924

25+
1026
jobs:
11-
compile:
27+
run-examples-with-8-jdk-and-latest:
28+
if: github.event.inputs.client_version == 'latest'
1229
runs-on: ubuntu-latest
1330
timeout-minutes: 15
14-
name: Compile (JDK 8)
31+
name: Run Examples With HEAD on JVM 8
1532
steps:
1633
- name: Check out repository
1734
uses: actions/checkout@v4
18-
- name: Check out PR
35+
- name: Install JDK 11 and Maven
36+
uses: actions/setup-java@v4
37+
with:
38+
distribution: "temurin"
39+
java-version: 17
40+
cache: "maven"
41+
- name: Install libraries
1942
run: |
20-
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
21-
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
22-
if: github.event.inputs.pr != ''
43+
java -version
44+
mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -DskipITs install
2345
- name: Install JDK 8 and Maven
2446
uses: actions/setup-java@v4
2547
with:
2648
distribution: "temurin"
27-
java-version: |
28-
8
29-
21
49+
java-version: 8
3050
cache: "maven"
31-
- name: Save Repo Artifacts
32-
id: save-repo-artifacts
33-
uses: actions/cache/save@v4
34-
with:
35-
path: ~/.m2/repository/com/clickhouse
36-
key: ${{ github.run_id }}-ch-artifacts
37-
- name: Build and install libraries
38-
run: mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -Dj8 -DskipITs install
39-
- name: Compile examples
51+
- name: Run Examples
4052
run: |
53+
java -version
54+
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 }}
4155
cd examples/jdbc
42-
mvn clean compile
43-
echo "Run Id ${{ github.run_id }}"
44-
run-examples:
56+
mvn --batch-mode --no-transfer-progress --show-version clean compile
57+
mvn --no-transfer-progress exec:java -Dexec.mainClass="com.clickhouse.examples.jdbc.Basic" -DchPassword=secret -DfailOnError=true
58+
run-examples-with-8-jdk-and-staging-release:
59+
if: github.event.inputs.client_version == 'pre_release'
4560
runs-on: ubuntu-latest
4661
timeout-minutes: 15
47-
name: Run Examples
48-
needs: compile
62+
name: Run Examples With Pre-Release on JVM 8
4963
steps:
5064
- name: Check out repository
5165
uses: actions/checkout@v4
52-
- name: Restore Repo Artifacts
53-
id: restore-repo-artifacts
54-
uses: actions/cache/restore@v4
66+
- name: Install JDK 8 and Maven
67+
uses: actions/setup-java@v4
5568
with:
56-
path: ~/.m2/repository/com/clickhouse
57-
key: ${{ github.run_id }}-ch-artifacts
69+
distribution: "temurin"
70+
java-version: 8
71+
cache: "maven"
5872
- name: Run Examples
5973
run: |
60-
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
74+
java -version
75+
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 }}
6176
cd examples/jdbc
77+
sed -i "s|<clickhouse-java.version>.*<\/clickhouse-java.version>|<clickhouse-java.version>${{ github.event.inputs.pre_release_version }}<\/clickhouse-java.version>|g" pom.xml
78+
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
6279
mvn --batch-mode --no-transfer-progress --show-version clean compile
63-
mvn exec:java -Dexec.mainClass="com.clickhouse.examples.jdbc.Basic" -DchPassword=secret -DfailOnError=true
80+
mvn --no-transfer-progress exec:java -Dexec.mainClass="com.clickhouse.examples.jdbc.Basic" -DchPassword=secret -DfailOnError=true

examples/jdbc/pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555

5656
<minJdk>1.8</minJdk>
5757
<clickhouse-packages.classifier>all</clickhouse-packages.classifier>
58+
<slf4j.version>2.0.16</slf4j.version>
5859
</properties>
5960

6061
<dependencies>
@@ -71,10 +72,16 @@
7172
<classifier>${clickhouse-packages.classifier}</classifier>
7273
</dependency>
7374

75+
<dependency>
76+
<groupId>org.slf4j</groupId>
77+
<artifactId>slf4j-api</artifactId>
78+
<version>${slf4j.version}</version>
79+
</dependency>
80+
7481
<dependency>
7582
<groupId>org.slf4j</groupId>
7683
<artifactId>slf4j-simple</artifactId>
77-
<version>2.0.16</version>
84+
<version>${slf4j.version}</version>
7885
<scope>runtime</scope>
7986
</dependency>
8087
</dependencies>

0 commit comments

Comments
 (0)