Perf #580
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}"}] |