-
Notifications
You must be signed in to change notification settings - Fork 76
75 lines (65 loc) · 2.38 KB
/
benchmark.yml
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
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