-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (68 loc) · 2.45 KB
/
benchmarks.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
76
77
78
79
80
81
82
83
on: [pull_request]
name: Benchmarks
jobs:
bench_baseline:
name: Benchmarks
runs-on: ubuntu-latest
steps:
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install cargo-criterion
run: cargo install cargo-criterion
- name: Checkout repository base
uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
- name: Run cargo criterion on base
run: cargo criterion --workspace
- name: Checkout repository head
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
clean: false # Do not remove bench from base branch
- name: Run cargo criterion on head
run: cargo criterion --workspace --message-format=json | python3 ./.github/format_bench.py > bench.md
- name: "Read file contents"
id: read_bench
uses: andstor/file-reader-action@v1
with:
path: "bench.md"
- name: Find Comment
uses: peter-evans/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: |
Comparing base (`${{ github.base_ref }}`) with HEAD (`${{ github.head_ref }}`).
- name: Create comment
if: ${{ steps.fc.outputs.comment-id == 0 }}
uses: peter-evans/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Comparing base (`${{ github.base_ref }}`) with HEAD (`${{ github.head_ref }}`).
<details>
<summary>Benchmark Results</summary>
${{ steps.read_bench.outputs.contents }}
</details>
- name: Update comment
if: ${{ steps.fc.outputs.comment-id != 0 }}
uses: peter-evans/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
Comparing base (`${{ github.base_ref }}`) with HEAD (`${{ github.head_ref }}`).
<details>
<summary>Benchmark Results</summary>
${{ steps.read_bench.outputs.contents }}
</details>