-
Notifications
You must be signed in to change notification settings - Fork 73
104 lines (90 loc) · 3.08 KB
/
benchmark.yml
File metadata and controls
104 lines (90 loc) · 3.08 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Benchmarks
on:
push:
branches: [ master ]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
pr-benchmark:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
- name: Restore benchmark baseline cache (from master)
uses: actions/cache@v4
with:
path: ./bench-cache
key: benchmark-refs/heads/master-${{ runner.os }}
restore-keys: |
benchmark-refs/heads/master-
- name: Run Criterion benchmarks (long)
env:
LOVELY_BENCH_MODE: long
run: |
cargo bench --bench patches -- --output-format bencher | tee bench-output.txt
- name: Compare against baseline and comment
uses: benchmark-action/github-action-benchmark@v1
with:
name: lovely-core patches
tool: 'cargo'
output-file-path: bench-output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
external-data-json-path: ./bench-cache/benchmark-data.json
save-data-file: false
comment-always: true
summary-always: true
fail-on-alert: false
# Adjust if needed, 150% might not be sensitive enough?
alert-threshold: '150%'
publish-benchmark:
# Run when pushing to master or when manually dispatched on master
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'master'
runs-on: ubuntu-latest
permissions:
contents: write
deployments: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
- name: Prepare/update baseline cache key
uses: actions/cache@v4
with:
path: ./bench-cache
key: benchmark-${{ github.ref }}-${{ github.sha }}-${{ runner.os }}
restore-keys: |
benchmark-${{ github.ref }}-
benchmark-refs/heads/master-
- name: Run Criterion benchmarks (long)
env:
LOVELY_BENCH_MODE: long
run: |
cargo bench --bench patches -- --output-format bencher | tee bench-output.txt
- name: Publish results to GitHub Pages
uses: benchmark-action/github-action-benchmark@v1
with:
name: lovely-core patches
tool: 'cargo'
output-file-path: bench-output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
gh-pages-branch: gh-pages
save-data-file: true
external-data-json-path: ./bench-cache/benchmark-data.json
# Keep charts concise
max-items-in-chart: 50