-
-
Notifications
You must be signed in to change notification settings - Fork 118
68 lines (55 loc) · 1.64 KB
/
rustbench.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
on:
pull_request:
paths:
- '**.rs'
- '**/Cargo.toml'
workflow_dispatch:
name: Benchmark
permissions:
pull-requests: write
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Install Critcmp
uses: baptiste0928/cargo-install@v2
with:
crate: critcmp
version: latest
- name: Run Benchmarks on changes
run: cargo bench --bench bench -- --save-baseline changes
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.sha }}
clean: false
- name: Run Benchmarks before changes
run: cargo bench --bench bench -- --save-baseline before
- name: Compare benchmarks
run: |
echo 'results<<EOF' >> $GITHUB_OUTPUT
critcmp before changes >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
id: compare
- name: Comment PR with benchmarks
uses: thollander/actions-comment-pull-request@v2
continue-on-error: true
with:
message: |
Benchmark results:
```
${{ steps.compare.outputs.results }}
```
comment_tag: benchmarks
id: comment
- name: If PR comment failed, write to PR summary
if: steps.comment.outcome != 'success'
run: |
echo '### Benchmark results' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '${{ steps.compare.outputs.results }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY