Skip to content

ci: add bench ci for pr #55

ci: add bench ci for pr

ci: add bench ci for pr #55

Workflow file for this run

name: Benchmark
on:
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:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure sccache
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Build xline
run: |
docker run -q --rm -v $(pwd):/xline \
-e SCCACHE_GHA_ENABLED=on \
-e ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL} \
-e ACTIONS_RUNTIME_TOKEN=${ACTIONS_RUNTIME_TOKEN} \
ghcr.io/xline-kv/build-env:latest \
cargo build --release --bin xline --bin benchmark
- run: |
cd scripts
cp ../target/release/{xline,benchmark} .
docker build . -t ghcr.io/xline-kv/xline:latest
docker pull datenlord/etcd:v3.5.5
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