|
1 | | -name: CodSpeed |
| 1 | +name: CodSpeed Benchmarks |
2 | 2 |
|
| 3 | +# trigger on manual dispatch, pushes to canary, and daily schedule |
3 | 4 | on: |
4 | | - # Run on pushes to the main branch |
| 5 | + workflow_dispatch: |
5 | 6 | push: |
6 | 7 | branches: |
7 | | - - "main" # or "master" |
8 | | - # Run on pull requests |
9 | | - pull_request: |
10 | | - # `workflow_dispatch` allows CodSpeed to trigger backtest |
11 | | - # performance analysis in order to generate initial data. |
12 | | - workflow_dispatch: |
| 8 | + - canary |
| 9 | + schedule: |
| 10 | + - cron: '0 5 * * *' # every day at 05:00 UTC |
13 | 11 |
|
14 | 12 | jobs: |
15 | | - benchmarks: |
16 | | - name: Run benchmarks |
| 13 | + benchmark: |
17 | 14 | runs-on: ubuntu-latest |
18 | 15 | steps: |
| 16 | + # 1. checkout your code |
19 | 17 | - uses: actions/checkout@v4 |
20 | | - # ... |
21 | | - # Setup your environment here: |
22 | | - # - Configure your Python/Rust/Node version |
23 | | - # - Install your dependencies |
24 | | - # - Build your benchmarks (if using a compiled language) |
25 | | - # ... |
| 18 | + |
| 19 | + # 2. ensure Node is available |
| 20 | + - name: Setup Node.js |
| 21 | + uses: actions/setup-node@v3 |
| 22 | + with: |
| 23 | + node-version: '18' |
| 24 | + |
| 25 | + # 3. install dependencies (adjust if you use npm/yarn) |
| 26 | + - name: Install dependencies |
| 27 | + run: pnpm install |
| 28 | + shell: bash |
| 29 | + |
| 30 | + # 4. install the CodSpeed runner (pins v3.5.0) |
| 31 | + - name: Install CodSpeed runner |
| 32 | + run: | |
| 33 | + curl -fsSL https://github.com/CodSpeedHQ/runner/releases/download/v3.5.0/codspeed-runner-installer.sh \ |
| 34 | + | dos2unix \ |
| 35 | + | bash |
| 36 | + shell: bash |
| 37 | + env: |
| 38 | + CODSPEED_RUNNER_VERSION: '3.5.0' |
| 39 | + |
| 40 | + # 5. actually run your benchmarks |
26 | 41 | - name: Run benchmarks |
27 | 42 | uses: CodSpeedHQ/action@v3 |
28 | 43 | with: |
29 | | - token: ${{ secrets.CODSPEED_TOKEN }} |
30 | | - run: "<Insert your benchmark command here>" |
| 44 | + version: '3.5.0' |
| 45 | + args: 'pnpm vitest bench --reporter=dot' |
0 commit comments