-
-
Notifications
You must be signed in to change notification settings - Fork 454
78 lines (65 loc) · 1.93 KB
/
profile.yaml
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
name: Rust Profiling with iai-callgrind
on:
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
profile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install Valgrind
run: |
sudo apt-get update
sudo apt-get install -y valgrind
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install iai-callgrind
run: |
cargo install [email protected]
# - name: Checkout master branch
# run: |
# git fetch origin master:master
# git checkout master
- name: Run baseline benchmarks
run: |
cargo bench --bench compile_demo_art --features=iai -- --save-baseline=master
- name: Checkout PR branch
run: |
git checkout ${{ github.event.pull_request.head.sha }}
- name: Run PR benchmarks
id: benchmark
run: |
BENCH_OUTPUT=$(cargo bench --bench compile_demo_art --features=iai -- --baseline=master)
ESCAPED_OUTPUT=$(echo "$BENCH_OUTPUT" | jq -sR .)
echo "BENCHMARK_OUTPUT=$ESCAPED_OUTPUT" >> $GITHUB_OUTPUT
- name: Comment PR
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const output = `#### Performance Benchmark Results
\`\`\`
${{ steps.benchmark.outputs.BENCHMARK_OUTPUT }}
\`\`\`
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})