Skip to content

Commit

Permalink
ci: add bench ci for pr
Browse files Browse the repository at this point in the history
Signed-off-by: iGxnon <igxnon@gmail.com>
  • Loading branch information
iGxnon committed Feb 18, 2024
1 parent 79bb994 commit 6d63469
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
31 changes: 30 additions & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Benchmark

on:
workflow_dispatch: {}
schedule:
- cron: "00 00 * * 1"
pull_request:
types: [labeled]

env:
CI_RUST_TOOLCHAIN: 1.71.0

jobs:
benchmark:
if: ${{ github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.label.name == 'run-benchmark') }}
name: benchmark
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -41,6 +43,33 @@ jobs:
bash ./benchmark.sh
- uses: actions/upload-artifact@v1
if: github.event_name == 'schedule'
with:
name: benchmark-output
path: scripts/out

- name: Find Comment
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Benchmark output

- name: Create comment
if: ${{ github.event_name == 'pull_request' && steps.fc.outputs.comment-id == '' }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: 'scripts/out/xline.txt'
reactions: rocket

- name: Update comment
if: ${{ github.event_name == 'pull_request' && steps.fc.outputs.comment-id != '' }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body-path: 'scripts/out/xline.txt'
reactions: hooray
edit-mode: replace
1 change: 1 addition & 0 deletions scripts/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ for server in "xline" "etcd"; do
logs_dir=${OUTPUT_DIR}/logs/${server}_logs
mkdir -p ${logs_dir}
result_file=${OUTPUT_DIR}/${server}.txt
printf "## Benchmark output" >>${result_file}
printf ${FORMAT} "QPS" "Latency(ms)" "Time(s)" "Command" >>${result_file}
case ${server} in
xline)
Expand Down

0 comments on commit 6d63469

Please sign in to comment.