Skip to content

Commit e2ad078

Browse files
authored
Merge pull request #5443 from matrix-org/poljar/ci/benchmarks
Enable benchmarks on the CI
2 parents 1be8b42 + d40f04e commit e2ad078

File tree

10 files changed

+178
-336
lines changed

10 files changed

+178
-336
lines changed

.github/workflows/benchmarks.yml

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,37 @@
11
name: Benchmarks
22

33
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
48
workflow_dispatch:
59

610
jobs:
711
benchmarks:
812
name: Run Benchmarks
913
runs-on: ubuntu-latest
10-
environment: matrix-rust-bot
11-
if: github.event_name == 'push'
14+
strategy:
15+
matrix:
16+
benchmark:
17+
- crypto_bench
18+
- event_cache
1219

1320
steps:
14-
- name: Checkout the repo
15-
uses: actions/checkout@v4
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
1622

17-
- name: Install Rust
18-
uses: dtolnay/rust-toolchain@master
19-
with:
20-
toolchain: nightly-2025-06-27
21-
components: rustfmt
23+
- name: Setup rust toolchain, cache and cargo-codspeed binary
24+
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670
25+
with:
26+
channel: stable
27+
cache-target: release
28+
bins: cargo-codspeed
2229

23-
- name: Run Benchmarks
24-
run: cargo bench | tee benchmark-output.txt
30+
- name: Build the benchmark target(s)
31+
run: cargo codspeed build -p benchmarks ${{ matrix.benchmark }} --features codspeed
2532

26-
- name: Check benchmark result for PR
27-
if: github.event_name == 'pull_request'
28-
uses: benchmark-action/github-action-benchmark@v1
29-
with:
30-
name: Rust Benchmark
31-
tool: 'cargo'
32-
output-file-path: benchmark-output.txt
33-
auto-push: false
34-
# comment to alert the user this has gone bad
35-
github-token: ${{ secrets.MRB_ACCESS_TOKEN }}
36-
alert-threshold: '120%'
37-
comment-on-alert: true
38-
fail-threshold: '150%'
39-
fail-on-alert: true
40-
41-
- name: Store benchmark result
42-
if: github.event_name != 'pull_request'
43-
uses: benchmark-action/github-action-benchmark@v1
44-
with:
45-
name: Rust Benchmark
46-
tool: 'cargo'
47-
output-file-path: benchmark-output.txt
48-
github-token: ${{ secrets.GITHUB_TOKEN }}
49-
auto-push: true
50-
# Show alert with commit comment on detecting possible performance regression
51-
alert-threshold: '150%'
52-
comment-on-alert: true
53-
fail-on-alert: true
54-
alert-comment-cc-users: '@gnunicornBen,@jplatte,@poljar'
33+
- name: Run the benchmarks
34+
uses: CodSpeedHQ/action@0b6e7a3d96c9d2a6057e7bcea6b45aaf2f7ce60b
35+
with:
36+
run: cargo codspeed run
37+
token: ${{ secrets.CODSPEED_TOKEN }}

0 commit comments

Comments
 (0)