Skip to content

Commit 9c0bdc8

Browse files
committed
Use codspeed runner and limit who can launch the codspeed workflow
1 parent 151e1e5 commit 9c0bdc8

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

.github/workflows/codspeed.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@ name: CodSpeed
22

33
on:
44
push:
5-
branches: [master]
6-
pull_request:
7-
# Allow CodSpeed to trigger backtest performance analysis
5+
branches: [ master ]
6+
pull_request: # Allow CodSpeed to trigger backtest performance analysis
7+
issue_comment:
8+
types: [created]
9+
810
workflow_dispatch:
911

12+
1013
permissions:
1114
contents: read
1215
id-token: write
1316

1417
concurrency:
15-
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
18+
group: ${{ github.workflow }}-${{ github.job }}-${{ github.event.pull_request.number || github.event.issue.number || github.ref }}
1619
cancel-in-progress: true
1720

1821
defaults:
@@ -22,10 +25,19 @@ defaults:
2225
jobs:
2326
benchmarks:
2427
name: Run benchmarks
25-
runs-on: ubuntu-latest
28+
runs-on: codspeed-macro
29+
if: |
30+
github.event_name != 'issue_comment' ||
31+
(github.event.issue.pull_request &&
32+
contains(github.event.comment.body, '/run-benchmarks') &&
33+
(github.event.comment.author_association == 'OWNER' ||
34+
github.event.comment.author_association == 'MEMBER' ||
35+
github.event.comment.author_association == 'COLLABORATOR'))
2636
steps:
2737
- name: Checkout code
2838
uses: actions/checkout@v6
39+
with:
40+
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || github.ref }}
2941

3042
- name: Set conda environment
3143
uses: mamba-org/setup-micromamba@main
@@ -41,11 +53,11 @@ jobs:
4153
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
4254
-DBUILD_BENCHMARK=ON \
4355
-DXTENSOR_USE_XSIMD=ON \
44-
-DCODSPEED_MODE=simulation
56+
-DCODSPEED_MODE=walltime
4557
cmake --build build --target benchmark_xtensor --parallel 8
4658
4759
- name: Run benchmarks
4860
uses: CodSpeedHQ/action@v4
4961
with:
50-
mode: simulation
62+
mode: walltime
5163
run: ./build/benchmark/benchmark_xtensor

0 commit comments

Comments
 (0)