|
1 | 1 | name: Benchmarks
|
2 | 2 |
|
3 | 3 | on:
|
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + pull_request: |
4 | 8 | workflow_dispatch:
|
5 | 9 |
|
6 | 10 | jobs:
|
7 | 11 | benchmarks:
|
8 | 12 | name: Run Benchmarks
|
9 | 13 | 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 |
12 | 19 |
|
13 | 20 | steps:
|
14 |
| - - name: Checkout the repo |
15 |
| - uses: actions/checkout@v4 |
| 21 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
16 | 22 |
|
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 |
22 | 29 |
|
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 |
25 | 32 |
|
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