-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (74 loc) · 2.79 KB
/
benchmark.yml
File metadata and controls
88 lines (74 loc) · 2.79 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
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
name: Benchmark
on:
workflow_dispatch:
# Cancel in-progress runs when new commits are pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Write permissions for pushing benchmark results
permissions:
contents: write
pull-requests: write
env:
CARGO_TERM_COLOR: always
jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C codegen-units=16 -C link-arg=-fuse-ld=mold"
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
- name: Install mold linker
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq mold
- name: Install development tools via Mise
uses: step-security/mise-action@2fa1b2b4fa1577588d8ac75f4dfa0f67c266d2a0 # v3.4.1
with:
install_args: protobuf
cache: true
- name: Cache Rust dependencies
uses: step-security/rust-cache@f8fba7098297c8c53a7c9a30575ec2ad4ad85056 # v2.8.2
with:
shared-key: benchmark-4-core
- name: Run benchmarks
run: cargo bench --workspace --no-fail-fast -- --output-format bencher | tee benchmark-results.txt
- name: Store benchmark result (main branch)
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
tool: "cargo"
output-file-path: benchmark-results.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: "125%" # Alert if 25% slower
fail-on-alert: true
comment-on-alert: true
- name: Comment benchmark result on PR
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
if: github.event_name == 'pull_request'
with:
tool: "cargo"
output-file-path: benchmark-results.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-on-alert: true
alert-threshold: "125%" # Alert if 25% slower
fail-on-alert: true
summary-always: true # Always post summary to PR