-
Notifications
You must be signed in to change notification settings - Fork 103
79 lines (64 loc) · 2.32 KB
/
benches.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
name: Benchmarks
on:
pull_request:
types:
- labeled
env:
OCAML_VERSION: "4.14.0"
RUST_TOOLCHAIN_VERSION: "1.71"
jobs:
bench:
runs-on: ubuntu-latest
name: Run benchmarks
if: github.event.label.name == 'benchmark'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Use shared Rust toolchain setting up steps
uses: ./.github/actions/toolchain-shared
with:
rust_toolchain_version: ${{ env.RUST_TOOLCHAIN_VERSION }}
- name: Install dependencies
run: |
set -x
cargo install cargo-criterion
- name: Use shared OCaml setting up steps
uses: ./.github/actions/ocaml-shared
with:
ocaml_version: ${{ env.OCAML_VERSION }}
# - name: Run iai bench
# run: |
# set -x
# cargo bench -p kimchi --bench proof_iai > iai_bench
# cat iai_bench
- name: Run criterion bench
run: |
set -x
eval $(opam env)
cargo criterion -p kimchi --bench proof_criterion --color never > criterion_bench 2>&1
cat criterion_bench
- name: Write result in PR
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
// read the output file
// const iai_bench = fs.readFileSync("iai_bench", {encoding:'utf8', flag:'r'});
const criterion_bench = fs.readFileSync("criterion_bench", {encoding:'utf8', flag:'r'});
// form message
const message = `Hello there👋
Here are some benchmark results using [criterion](https://bheisler.github.io/criterion.rs/). Keep in mind that since this runs in CI, it is not really accurate (as it depends on the host load)
<pre><code>${criterion_bench}</code></pre>`;
/*
const iai = `Here's some more accurate benchmark with [iai](https://github.com/bheisler/iai)
<pre><code>${iai_bench}</code></pre>`;
*/
// post comment
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: message
})