-
Notifications
You must be signed in to change notification settings - Fork 6
134 lines (118 loc) · 4.08 KB
/
perf.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Perf
on:
pull_request:
branches:
- main
paths:
- "benchmarks/**"
- "script/transform.go"
# - ".github/workflows/perf.yaml"
push:
branches:
- main
paths:
- "benchmarks/**"
- "script/transform.go"
# - ".github/workflows/perf.yaml"
schedule:
- cron: '25 0 * * 1,3'
workflow_dispatch:
inputs:
imageTag:
required: false
default: ''
description: ''
jobs:
perf:
name: Databend Release Perf
runs-on: [self-hosted, X64, Linux, 4c8g, gcp]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Get Databend version
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ -z "${{ github.event.inputs.imageTag }}" ]; then
LASTEST_RELEASE=$(gh api repos/datafuselabs/databend/tags -X GET -f per_page=1 | jq -r .[].name)
echo "DATABEND_VERSION=${LASTEST_RELEASE}" >> $GITHUB_ENV
else
echo "DATABEND_VERSION=${{ github.event.inputs.imageTag }}" >> $GITHUB_ENV
fi
- name: Get Date
run: |
echo "PERF_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
- name: Setup BendSQL
uses: ./.github/actions/setup-bendsql
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '>=1.20.0'
- name: Run Perf
env:
WAREHOUSE_NAME: query-perf
BENDSQL_DSN: ${{ secrets.PERF_BENDSQL_DSN }}
run: |
echo "DROP WAREHOUSE IF EXISTS '${WAREHOUSE_NAME}';" | bendsql
echo "CREATE WAREHOUSE '${WAREHOUSE_NAME}' WITH version='${{ env.DATABEND_VERSION }}' warehouse_size='XLarge';" | bendsql
echo "SHOW WAREHOUSES;" | bendsql
export DATABEND_DSN="${BENDSQL_DSN}&warehouse=${WAREHOUSE_NAME}"
max_retry=15
counter=0
until bendsql --query="SHOW WAREHOUSES LIKE '${WAREHOUSE_NAME}'" --output=tsv | grep -q "Running"; do
if [ $counter -eq $max_retry ]; then
echo "Failed to start warehouse ${WAREHOUSE_NAME}"
exit 1
fi
counter=$((counter+1))
echo "Waiting for warehouse ${WAREHOUSE_NAME} to start"
sleep 10
done
go run benchmarks/cmd/main.go \
--test-dir benchmarks \
--output-format json \
--output-dir collector \
--size XLarge
mv collector/numbers.json collector/numbers/${{ env.PERF_DATE }}-numbers.json
mv collector/hits.json collector/hits/${{ env.PERF_DATE }}-hits.json
- name: Clean warehouse
if: ${{ always() }}
env:
WAREHOUSE_NAME: query-perf
BENDSQL_DSN: ${{ secrets.PERF_BENDSQL_DSN }}
run: |
echo "DROP WAREHOUSE IF EXISTS '${WAREHOUSE_NAME}';" | bendsql
- name: Push changes
uses: EndBug/add-and-commit@v9
with:
message: 'perf: collect performance data from the latest release'
pull: '--rebase --autostash origin main'
push: origin ${{ github.head_ref }}
- name: Do Transform
run: go run script/transform.go
- name: Upload Result
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
publish_branch: gh-pages
publish_dir: temp
destination_dir: json
keep_files: false
commit_message: 'Update Transform Data'
- name: Notify Feishu Group
uses: foxundermoon/feishu-action@v2
if: ${{ always() }}
with:
url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }}
msg_type: post
content: |
post:
zh_cn:
title: Build job of ${{ github.repository }} run ${{ job.status }}
content:
- [{"tag": "a", "text": "link", "href": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}]