-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 2.02 KB
/
bench.yml
File metadata and controls
70 lines (59 loc) · 2.02 KB
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
name: Benchmark
on:
push:
branches: [main]
pull_request:
permissions:
contents: write # needed for auto-push to gh-pages on main branch
pull-requests: write # needed for posting benchmark regression comments
concurrency:
group: bench-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
benchmark:
name: Performance regression check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable)
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
- name: Cache cargo registry & target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: bench-${{ runner.os }}-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
restore-keys: |
bench-${{ runner.os }}-
- name: Run benchmarks
run: cargo bench --bench rust_bench -- --output-format bencher | tee output.txt
- name: Reset Cargo.lock changes
run: git checkout -- Cargo.lock
- name: Ensure gh-pages branch exists
run: |
if ! git ls-remote --exit-code --heads origin gh-pages; then
echo "Creating gh-pages branch..."
git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "Initialize gh-pages branch for benchmark data"
git push origin gh-pages
git checkout -
fi
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: cargo
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: ${{ github.ref == 'refs/heads/main' }}
comment-on-alert: true
alert-threshold: '105%'
fail-on-alert: false
gh-pages-branch: gh-pages
benchmark-data-dir-path: dev/bench