Skip to content

Commit 1a63037

Browse files
committed
Merge branch 'main' into native-ci
2 parents c44f8e8 + 1b233aa commit 1a63037

File tree

158 files changed

+3067
-3589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+3067
-3589
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: "Benchmark Cloud"
2+
description: "Run benchmark for S3 with cloud storage"
3+
inputs:
4+
sha:
5+
description: "commit sha"
6+
required: true
7+
run_id:
8+
description: "benchmark run id"
9+
required: true
10+
dataset:
11+
description: "hits/tpch"
12+
required: true
13+
source:
14+
description: "pr/release"
15+
required: true
16+
source_id:
17+
description: "pr_id/release_tag"
18+
required: true
19+
size:
20+
description: "Small/Medium/Large"
21+
required: true
22+
image_tag:
23+
description: "Databend image tag"
24+
required: true
25+
cloud_email:
26+
description: "Benchmark cloud email"
27+
required: true
28+
cloud_password:
29+
description: "Benchmark cloud password"
30+
required: true
31+
cloud_org:
32+
description: "Benchmark cloud org"
33+
required: true
34+
cloud_endpoint:
35+
description: "Benchmark cloud endpoint"
36+
required: true
37+
38+
runs:
39+
using: "composite"
40+
steps:
41+
- uses: ./.github/actions/setup_bendsql
42+
43+
- name: Install script dependencies
44+
shell: bash
45+
run: |
46+
sudo apt-get update -y
47+
sudo apt-get install -y jq bc
48+
49+
- name: Run Benchmark
50+
working-directory: benchmark/clickbench
51+
env:
52+
BENCHMARK_ID: ${{ inputs.run_id }}
53+
BENCHMARK_DATASET: ${{ inputs.dataset }}
54+
BENCHMARK_SIZE: ${{ inputs.size }}
55+
BENCHMARK_IMAGE_TAG: ${{ inputs.image_tag }}
56+
CLOUD_EMAIL: ${{ inputs.cloud_email }}
57+
CLOUD_PASSWORD: ${{ inputs.cloud_password }}
58+
CLOUD_ORG: ${{ inputs.cloud_org }}
59+
CLOUD_ENDPOINT: ${{ inputs.cloud_endpoint }}
60+
shell: bash
61+
run: |
62+
./benchmark_cloud.sh
63+
64+
- name: Prepare Metadata
65+
working-directory: benchmark/clickbench
66+
shell: bash
67+
run: |
68+
jq ".date = \"$(date -u +%Y-%m-%d)\"" <result.json >result.json.tmp && mv result.json.tmp result.json
69+
case ${{ inputs.source }} in
70+
pr)
71+
BENCHMARK_SYSTEM="Databend(PR#${{ inputs.source_id }})"
72+
BENCHMARK_TYPE="PR"
73+
;;
74+
release)
75+
BENCHMARK_SYSTEM="Databend(Release@${{ inputs.source_id }})"
76+
BENCHMARK_TYPE="Release"
77+
;;
78+
*)
79+
echo "Unspported benchmark source: ${{ inputs.source }}"
80+
exit 1
81+
esac
82+
jq ".system = \"${BENCHMARK_SYSTEM}\"" <result.json >result.json.tmp && mv result.json.tmp result.json
83+
84+
case ${{ inputs.size }} in
85+
Medium)
86+
BENCHMARK_CLUSTER_SIZE=16
87+
;;
88+
Large)
89+
BENCHMARK_CLUSTER_SIZE=64
90+
;;
91+
*)
92+
echo "Unspported benchmark size: ${{ inputs.size }}"
93+
exit 1
94+
esac
95+
jq ".cluster_size = \"${BENCHMARK_CLUSTER_SIZE}\"" <result.json >result.json.tmp && mv result.json.tmp result.json
96+
jq ".machine = \"${{ inputs.size }}\"" <result.json >result.json.tmp && mv result.json.tmp result.json
97+
jq ".tags = [\"${BENCHMARK_TYPE}\", \"serverless\"]" <result.json >result.json.tmp && mv result.json.tmp result.json
98+
jq ".comment = \"commit:${{ inputs.sha }}\"" <result.json >result.json.tmp && mv result.json.tmp result.json
99+
mv result.json result-${{ inputs.dataset }}-cloud.json
100+
101+
- name: Upload artifact
102+
uses: actions/upload-artifact@v3
103+
with:
104+
name: benchmark-${{ inputs.dataset }}-cloud-${{ inputs.size }}
105+
path: benchmark/clickbench/result-${{ inputs.dataset }}-cloud-${{ inputs.size }}.json

.github/actions/benchmark/action.yml renamed to .github/actions/benchmark_local/action.yml

Lines changed: 16 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
name: "Benchmark"
2-
description: "Run benchmark"
1+
name: "Benchmark Local"
2+
description: "Run benchmark for local filesystem"
33
inputs:
4-
storage:
5-
description: "s3/fs"
4+
sha:
5+
description: "commit sha"
6+
required: true
7+
run_id:
8+
description: "benchmark run id"
69
required: true
710
dataset:
811
description: "hits/tpch"
@@ -16,29 +19,7 @@ inputs:
1619
runs:
1720
using: "composite"
1821
steps:
19-
- name: Download artifact
20-
uses: ./.github/actions/artifact_download
21-
with:
22-
profile: release
23-
sha: ${{ github.sha }}
24-
target: x86_64-unknown-linux-gnu
25-
26-
- name: Setup Databend Binary
27-
shell: bash
28-
run: |
29-
sudo cp ./target/release/databend-query /usr/local/bin/databend-query
30-
sudo cp ./target/release/databend-meta /usr/local/bin/databend-meta
31-
databend-query --version
32-
databend-meta --version
33-
34-
- name: Setup BendSQL
35-
shell: bash
36-
run: |
37-
curl -fsSLo ./bendsql.tar.gz https://github.com/databendcloud/bendsql/releases/download/v0.3.5/bendsql-linux-amd64.tar.gz
38-
tar -xvzf ./bendsql.tar.gz
39-
chmod +x ./linux-amd64/bendsql
40-
sudo cp ./linux-amd64/bendsql /usr/local/bin/bendsql
41-
bendsql version
22+
- uses: ./.github/actions/setup_bendsql
4223

4324
- name: Install script dependencies
4425
shell: bash
@@ -49,29 +30,16 @@ runs:
4930
- name: Run Benchmark
5031
working-directory: benchmark/clickbench
5132
env:
52-
BENCHMARK_ID: ${{ github.run_id }}
53-
BENCHMARK_STORAGE: ${{ inputs.storage }}
33+
BENCHMARK_ID: ${{ inputs.run_id }}
5434
BENCHMARK_DATASET: ${{ inputs.dataset }}
5535
shell: bash
5636
run: |
57-
./benchmark.sh
37+
./benchmark_local.sh
5838
5939
- name: Prepare Metadata
6040
working-directory: benchmark/clickbench
6141
shell: bash
6242
run: |
63-
case ${{ inputs.storage }} in
64-
s3)
65-
BENCHMARK_STORAGE="s3"
66-
;;
67-
fs)
68-
BENCHMARK_STORAGE="gp3"
69-
;;
70-
*)
71-
echo "Unspported benchmark storage: ${{ inputs.storage }}"
72-
exit 1
73-
esac
74-
7543
case ${{ inputs.source }} in
7644
pr)
7745
BENCHMARK_SYSTEM="Databend(PR#${{ inputs.source_id }})"
@@ -87,18 +55,18 @@ runs:
8755
esac
8856
jq ".system = \"${BENCHMARK_SYSTEM}\"" <result.json >result.json.tmp && mv result.json.tmp result.json
8957
jq ".date = \"$(date -u +%Y-%m-%d)\"" <result.json >result.json.tmp && mv result.json.tmp result.json
90-
jq ".machine = \"c5.4xlarge,${BENCHMARK_STORAGE}\"" <result.json >result.json.tmp && mv result.json.tmp result.json
58+
jq ".machine = \"c5.4xlarge,gp3\"" <result.json >result.json.tmp && mv result.json.tmp result.json
9159
jq ".cluster_size = 1" <result.json >result.json.tmp && mv result.json.tmp result.json
92-
jq ".comment = \"commit:${{ github.sha }}\"" <result.json >result.json.tmp && mv result.json.tmp result.json
93-
jq ".tags = [\"${BENCHMARK_TYPE}\", \"${BENCHMARK_STORAGE}\"]" <result.json >result.json.tmp && mv result.json.tmp result.json
60+
jq ".comment = \"commit:${{ inputs.sha }}\"" <result.json >result.json.tmp && mv result.json.tmp result.json
61+
jq ".tags = [\"${BENCHMARK_TYPE}\", \"gp3\"]" <result.json >result.json.tmp && mv result.json.tmp result.json
9462
jq ".extra.${{ inputs.source }} = \"${{ inputs.source_id }}\"" <result.json >result.json.tmp && mv result.json.tmp result.json
95-
mv result.json result-${{ inputs.dataset }}-${{ inputs.storage }}.json
63+
mv result.json result-${{ inputs.dataset }}-local.json
9664
9765
- name: Upload artifact
9866
uses: actions/upload-artifact@v3
9967
with:
100-
name: benchmark-${{ inputs.dataset }}-${{ inputs.storage }}
101-
path: benchmark/clickbench/result-${{ inputs.dataset }}-${{ inputs.storage }}.json
68+
name: benchmark-${{ inputs.dataset }}-local
69+
path: benchmark/clickbench/result-${{ inputs.dataset }}-local.json
10270

10371
- name: Clean test data
10472
working-directory: benchmark/clickbench
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Setup BendSQL"
2+
description: "Setup BendSQL for CI"
3+
inputs:
4+
version:
5+
description: "bendsql version"
6+
required: false
7+
default: v0.3.5
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Download and Install
12+
shell: bash
13+
run: |
14+
curl -fsSLo ./bendsql.tar.gz https://github.com/databendcloud/bendsql/releases/download/${{ inputs.version }}/bendsql-linux-amd64.tar.gz
15+
tar -xvzf ./bendsql.tar.gz
16+
chmod +x ./linux-amd64/bendsql
17+
sudo cp ./linux-amd64/bendsql /usr/local/bin/bendsql
18+
bendsql version

.github/workflows/benchmark.yml

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ on:
1515
- "**.md"
1616
- "docker/**"
1717
- ".devcontainer/**"
18-
workflow_dispatch:
19-
inputs:
20-
tag:
21-
description: The tag to run benchmark
22-
required: true
23-
type: string
2418

2519
concurrency:
2620
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
@@ -29,13 +23,10 @@ concurrency:
2923
env:
3024
BUILD_PROFILE: release
3125
RUNNER_PROVIDER: aws
32-
CARGO_INCREMENTAL: 0
33-
# Remove this env after rust 1.68 has been released.
34-
CARGO_UNSTABLE_SPARSE_REGISTRY: true
3526

3627
jobs:
3728
build_release:
38-
if: github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'ci-benchmark')
29+
if: contains(github.event.pull_request.labels.*.name, 'ci-benchmark')
3930
timeout-minutes: 30
4031
runs-on: [self-hosted, X64, Linux, perf]
4132
steps:
@@ -47,40 +38,14 @@ jobs:
4738
with:
4839
target: x86_64-unknown-linux-gnu
4940
profile: release
50-
51-
clickbench:
52-
needs: build_release
53-
timeout-minutes: 30
54-
runs-on: [self-hosted, X64, Linux, perf]
55-
strategy:
56-
matrix:
57-
storage:
58-
- s3
59-
- fs
60-
dataset:
61-
- hits
62-
- tpch
63-
steps:
64-
- uses: actions/checkout@v3
65-
- name: Get benchmark source
41+
- name: Generate benchmark metadata
6642
run: |
67-
case ${{ github.event_name }} in
68-
pull_request)
69-
echo "BENCHMARK_SOURCE=pr" > $GITHUB_ENV
70-
echo "BENCHMARK_SOURCE_ID=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
71-
;;
72-
workflow_dispatch)
73-
echo "BENCHMARK_SOURCE=release" > $GITHUB_ENV
74-
echo "BENCHMARK_SOURCE_ID=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
75-
;;
76-
*)
77-
echo "Unknown event name: ${{ github.event_name }}"
78-
exit 1
79-
;;
80-
esac
81-
- uses: ./.github/actions/benchmark
43+
echo '{}' > metadata.json
44+
jq ".sha = \"${{ github.sha }}\"" <metadata.json >metadata.json.tmp && mv metadata.json.tmp metadata.json
45+
jq ".run_id = \"${{ github.run_id }}\"" <metadata.json >metadata.json.tmp && mv metadata.json.tmp metadata.json
46+
jq ".pr_id = \"${{ github.event.pull_request.number }}\"" <metadata.json >metadata.json.tmp && mv metadata.json.tmp metadata.json
47+
- name: Upload artifact
48+
uses: actions/upload-artifact@v3
8249
with:
83-
storage: ${{ matrix.storage }}
84-
dataset: ${{ matrix.dataset }}
85-
source: ${{ env.BENCHMARK_SOURCE }}
86-
source_id: ${{ env.BENCHMARK_SOURCE_ID }}
50+
name: benchmark-metadata
51+
path: metadata.json

.github/workflows/release.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ jobs:
7676
gh release create ${{ steps.generated-tag.outputs.tag }} --generate-notes -p
7777
env:
7878
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79-
- name: Trigger benchmark
80-
continue-on-error: true
81-
run: |
82-
echo "Trigger benchmark for ${{ steps.generated-tag.outputs.tag }}"
83-
gh workflow run benchmark.yml -f tag=${{ steps.generated-tag.outputs.tag }}
84-
env:
85-
GH_TOKEN: ${{ secrets.DATABEND_BOT_TOKEN }}
86-
8779

8880
publish_macos:
8981
name: macos assets
@@ -343,7 +335,6 @@ jobs:
343335
platforms: linux/amd64,linux/arm64
344336
context: .
345337
file: ./docker/Dockerfile
346-
build-args: VERSION=${{ needs.create_release.outputs.version }}
347338
- name: Update repo description
348339
uses: peter-evans/dockerhub-description@v3
349340
with:
@@ -416,7 +407,6 @@ jobs:
416407
platforms: linux/amd64,linux/arm64
417408
context: .
418409
file: ./docker/${{ matrix.distro }}/${{ matrix.service }}.Dockerfile
419-
build-args: VERSION=${{ needs.create_release.outputs.version }}
420410

421411
release_packages:
422412
name: release packages
@@ -523,6 +513,14 @@ jobs:
523513
asset_name: sha256sums.txt
524514
asset_content_type: text/plain
525515

516+
run_benchmark:
517+
name: run benchmark
518+
needs: [create_release, publish_linux]
519+
uses: ./.github/workflows/trusted-benchmark.yml
520+
secrets: inherit
521+
with:
522+
tag: ${{ needs.create_release.outputs.version }}
523+
526524
notify_build_result:
527525
name: notify build result
528526
runs-on: ubuntu-latest
@@ -538,7 +536,7 @@ jobs:
538536
steps:
539537
- uses: actions/checkout@v3
540538
- run: |
541-
status="${{ (contains(needs.*.result, 'failed') && 'failed') || (contains(needs.*.result, 'cancelled') && 'cancelled') || 'success' }}"
539+
status="${{ (contains(needs.*.result, 'failure') && 'failure') || (contains(needs.*.result, 'cancelled') && 'cancelled') || 'success' }}"
542540
jq -n -f .github/release-report.jq \
543541
--arg title "[Release] ${{ needs.create_release.outputs.version }}" \
544542
--arg content "Build result: ${status}" \

0 commit comments

Comments
 (0)