Skip to content
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
124 changes: 124 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Benchmark

on:
workflow_dispatch:
inputs:
clickhouse:
description: "ClickHouse version"
required: true
default: "latest"
java:
description: "Java version"
required: true
default: "8"
baseline:
description: "Baseline to compare"
required: true
default: "0.2.6"
driver:
description: "Driver version"
required: true
default: "0.3.0-SNAPSHOT"
options:
description: "Benchmark options"
required: true
default: "-prof gc 'Query|Insertion'"
pr:
description: "Pull request#"
required: false

jobs:
benchmark:
runs-on: ubuntu-latest
name: Benchmark on demand
if: github.event_name == 'workflow_dispatch'
steps:
- name: Check out repository
uses: actions/checkout@v2
- 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: Set up JDK ${{ github.event.inputs.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ github.event.inputs.java }}
continue-on-error: true
- name: Update version and group id
run: |
find . -type f -name "pom.xml" -exec sed -i -e 's|${revision}|${{ github.event.inputs.driver }}|g' \
-e 's|${parent.groupId}|tech.clickhouse|g' '{}' \;
sed -i -e 's|^\( <version>\).*\(</version>\)$|\1${{ github.event.inputs.driver }}\2|' pom.xml
continue-on-error: true
- name: Install driver as needed
run: mvn --batch-mode --update-snapshots -q -DskipTests install
if: endsWith(github.event.inputs.driver, '-SNAPSHOT')
continue-on-error: true
- name: Build project
run: |
cd clickhouse-benchmark
mvn --batch-mode --update-snapshots -Drevision=${{ github.event.inputs.driver }} \
-DclickhouseVersion=${{ github.event.inputs.clickhouse }} install
java -jar target/benchmarks.jar -rf json ${{ github.event.inputs.options }} > output.txt
echo "BENCHMARK_REPORT<<EOF" >> $GITHUB_ENV
tail -n +$(grep -n '^REMEMBER:' output.txt | tail -1 | awk -F: '{print $1+6}') output.txt | head -n -2 | grep -v ':·' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
cd -
id: benchmark
continue-on-error: true
- name: Record benchmark results
run: |
mv -fv clickhouse-benchmark/jmh-result.json \
clickhouse-benchmark/docs/results/v${{ github.event.inputs.driver }}.json
if: github.event.inputs.pr == ''
continue-on-error: true
- name: Record pull request benchmark results
run: |
mv -fv clickhouse-benchmark/jmh-result.json \
clickhouse-benchmark/docs/results/pull-request_${{github.event.inputs.pr}}.json
if: github.event.inputs.pr != ''
continue-on-error: true
- name: Commit benchmark result
uses: zhicwu/add-and-commit@v7
with:
add: 'clickhouse-benchmark/docs/results/*.json'
author_name: zhicwu
author_email: [email protected]
branch: develop
message: 'Record benchmark results'
push: true
continue-on-error: true
- name: Get commit hash
run: |
echo ::set-output name=hash::$(git log --pretty=format:'%H' -n 1)
id: commit
continue-on-error: true
- name: 'Comment PR'
uses: actions/github-script@v3
if: github.event.inputs.pr != ''
env:
PR_NO: ${{ github.event.inputs.pr }}
COMMIT_HASH: ${{ steps.commit.outputs.hash }}
COMPARE_TO: ${{ github.event.inputs.baseline }}
CLICKHOUSE_VRESION: ${{ github.event.inputs.clickhouse }}
DRIVER_VRESION: ${{ github.event.inputs.driver }}
JAVA_VERSION: ${{ github.event.inputs.java }}
PREV_STEP_RESULT: '${{ steps.benchmark.outcome }}'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = process.env.PR_NO;
const { repo: { owner, repo } } = context;
const result = process.env.PREV_STEP_RESULT;
const compareUrl = `http://jmh.morethan.io/?sources=https://raw.githubusercontent.com/${owner}/${repo}/develop/clickhouse-benchmark/docs/results/v${process.env.COMPARE_TO}.json,https://raw.githubusercontent.com/${owner}/${repo}/${process.env.COMMIT_HASH || 'develop'}/clickhouse-benchmark/docs/results/${issue_number ? 'pull-request_' + issue_number : 'v' + process.env.DRIVER_VERSION}.json`;
// const benchmarkUrl = `http://jmh.morethan.io/?source=https://raw.githubusercontent.com/${owner}/${repo}/${process.env.COMMIT_HASH || 'develop'}/clickhouse-benchmark/docs/results/${issue_number ? 'pull-request_' + issue_number : 'v' + process.env.DRIVER_VERSION}.json`;
const buildUrl = `https://github.com/${owner}/${repo}/actions/runs/${context.runId}`;
const flag = result === 'success'
? ':green_circle:'
: (result === 'failure' ? ':red_circle:' : ':yellow_circle:');
const msg = `${flag} [benchmark](${compareUrl}) using JDK [${process.env.JAVA_VERSION}] and ClickHouse [${process.env.CLICKHOUSE_VRESION}]: [${result}](${buildUrl})`
+ '<details>\n<summary>Expand to see details...</summary>\n\n```\n'
+ process.env.BENCHMARK_REPORT || ''
+ '\n```\n</details>';
github.issues.createComment({ issue_number, owner, repo, body: msg });
13 changes: 8 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,30 @@ on:
branches:
- master
- develop
- 0.2.x
paths-ignore:
- "CHANGELOG"
- "**.md"
- "docs/**"
- "**/CHANGELOG"

pull_request:
types:
- opened
- synchronize
- reopened
paths-ignore:
- "CHANGELOG"
- "**.md"
- "docs/**"
- "**/CHANGELOG"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 9, 11]
# most recent LTS releases and latest stable build
clickhouse: ["19.14", "20.3", "20.8", "latest"]
java: [8, 11]
# most recent LTS releases as well as latest stable builds
clickhouse: ["19.14", "20.3", "20.8", "20.10", "20.12", "21.2", "latest"]
name: Build using JDK ${{ matrix.java }} against ClickHouse ${{ matrix.clickhouse }}
steps:
- name: Check out Git repository
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
version:
description: "Release version"
required: true
default: "0.2.6-SNAPSHOT"
default: "0.3.0-SNAPSHOT"

jobs:
release:
Expand All @@ -19,13 +19,14 @@ jobs:
- name: Install Java and Maven
uses: actions/setup-java@v1
with:
java-version: 1.8
- run: sed -i -e 's|^\( <version>\).*\(</version>\)$|\1${{ github.event.inputs.version }}\2|' pom.xml
java-version: 8
- run: find . -type f -name "pom.xml" -exec sed -i -e 's|${revision}|${{ github.event.inputs.version }}|g' -e 's|${parent.groupId}|tech.clickhouse|g' '{}' \;
- run: find . -type f -name "log4j.properties" -exec sed -i -e 's|DEBUG|WARN|g' '{}' \;
- name: Release Maven package
uses: samuelmeuli/action-maven-publish@v1
with:
maven_profiles: release
maven_args: --batch-mode
maven_args: -q --batch-mode
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
nexus_username: ${{ secrets.SONATYPE_USER }}
Expand Down
115 changes: 109 additions & 6 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,126 @@ on:
pr:
description: "Pull request#"
required: false
pull_request:
types:
- opened
- synchronize
- reopened
paths-ignore:
- "**.md"
- "docs/**"
- "**/CHANGELOG"
issue_comment:
types:
- created
- edited

jobs:
verify:
verify-commented-pr:
runs-on: ubuntu-latest
name: Verify branch/PR using JDK ${{ github.event.inputs.java }} against ClickHouse ${{ github.event.inputs.clickhouse }}
name: Verify commented PR
if: github.event_name == 'issue_comment' && github.event.issue.pull_request
steps:
- uses: zhicwu/pull-request-comment-trigger@master
id: check
with:
trigger: '@verify'
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Extra parameters from PR comment
if: steps.check.outputs.triggered == 'true'
uses: actions/github-script@v3
id: commented
env:
COMMENT_BODY: '${{ github.event.comment.body }}'
with:
script: |
const keyword = '@verify';
let buildArgs = process.env.COMMENT_BODY;
core.info(`Got commented body: ${buildArgs}`);
buildArgs = buildArgs.substring(buildArgs.lastIndexOf(keyword) + keyword.length);
const args = buildArgs.match(/[^\s]+/g);
core.info(`Got commented arguments: ${args}`);

return {
pr: context.issue.number,
clickhouse: args && args.length > 0 ? args[0] : "latest",
java: args && args.length > 1 ? args[1] : "8"
};
- name: Check out repository
uses: actions/checkout@v2
if: github.event.inputs.pr == ''
- name: Check out PR ${{ github.event.inputs.pr }}
- name: Check out commented PR
if: steps.check.outputs.triggered == 'true'
run: |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin pull/${{ fromJSON(steps.commented.outputs.result).pr }}/merge:merged-pr && git checkout merged-pr
- name: Set up JDK
if: steps.check.outputs.triggered == 'true'
uses: actions/setup-java@v1
with:
java-version: ${{ fromJSON(steps.commented.outputs.result).java }}
continue-on-error: true
- name: Verify with Maven
if: steps.check.outputs.triggered == 'true'
run: mvn --batch-mode --update-snapshots -DclickhouseVersion=${{ fromJSON(steps.commented.outputs.result).clickhouse }} verify
id: maven
continue-on-error: true
- name: Comment PR
uses: actions/github-script@v3
if: steps.check.outputs.triggered == 'true'
env:
CLICKHOUSE_VRESION: ${{ fromJSON(steps.commented.outputs.result).clickhouse }}
JAVA_VERSION: ${{ fromJSON(steps.commented.outputs.result).java }}
PREV_STEP_RESULT: '${{ steps.maven.outcome }}'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
const result = process.env.PREV_STEP_RESULT;
const buildUrl = `https://github.com/${owner}/${repo}/actions/runs/${context.runId}`;
const flag = result === 'success'
? ':green_circle:'
: (result === 'failure' ? ':red_circle:' : ':yellow_circle:');
const msg = `${flag} verify using JDK [${process.env.JAVA_VERSION}] and ClickHouse [${process.env.CLICKHOUSE_VRESION}]: [${result}](${buildUrl})`;
github.issues.createComment({ issue_number, owner, repo, body: msg });

verify-on-demand:
runs-on: ubuntu-latest
name: Verify on demand
if: github.event_name == 'workflow_dispatch'
steps:
- name: Check out repository
uses: actions/checkout@v2
- 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 != ''
with:
ref: refs/remotes/pull/${{ github.event.inputs.pr }}/merge
- name: Set up JDK ${{ github.event.inputs.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ github.event.inputs.java }}
continue-on-error: true
- name: Verify with Maven
run: mvn --batch-mode --update-snapshots -DclickhouseVersion=${{ github.event.inputs.clickhouse }} verify
id: maven
continue-on-error: true
- name: 'Comment PR'
uses: actions/github-script@v3
if: github.event.inputs.pr != ''
env:
PR_NO: ${{ github.event.inputs.pr }}
CLICKHOUSE_VRESION: ${{ github.event.inputs.clickhouse }}
JAVA_VERSION: ${{ github.event.inputs.java }}
PREV_STEP_RESULT: '${{ steps.maven.outcome }}'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = process.env.PR_NO;
const { repo: { owner, repo } } = context;
const result = process.env.PREV_STEP_RESULT;
const buildUrl = `https://github.com/${owner}/${repo}/actions/runs/${context.runId}`;
const flag = result === 'success'
? ':green_circle:'
: (result === 'failure' ? ':red_circle:' : ':yellow_circle:');
const msg = `${flag} verify using JDK [${process.env.JAVA_VERSION}] and ClickHouse [${process.env.CLICKHOUSE_VRESION}]: [${result}](${buildUrl})`;
github.issues.createComment({ issue_number, owner, repo, body: msg });
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# VSCode
.vscode
.factorypath

# Eclipse
.classpath
Expand Down
Empty file.
Empty file.
Empty file.
Loading