Skip to content

Commit 74ce940

Browse files
[ci] Add fast benchmark dry run
1 parent ee30b3d commit 74ce940

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name: Benchmark
33
on:
44
workflow_dispatch:
55
inputs:
6+
dry_run:
7+
description: "Generate synthetic benchmark output instead of running cargo bench"
8+
required: false
9+
default: true
10+
type: boolean
611
publish:
712
description: "Publish results to the benchmarks repository"
813
required: false
@@ -68,17 +73,24 @@ jobs:
6873
- name: Run setup
6974
uses: ./.github/actions/setup
7075
- name: Compile benchmarks
76+
if: github.event_name == 'schedule' || !inputs.dry_run || inputs.publish
7177
env:
7278
RUSTFLAGS: "--cfg full_bench"
7379
run: cargo bench ${{ matrix.cargo_flags }} --benches -p ${{ matrix.package }} --no-run
7480
- name: Run benchmarks
81+
if: github.event_name == 'schedule' || !inputs.dry_run || inputs.publish
7582
env:
7683
RUSTFLAGS: "--cfg full_bench"
7784
run: |
7885
cargo bench ${{ matrix.cargo_flags }} \
7986
--benches -p ${{ matrix.package }} \
8087
-- --output-format bencher \
8188
| tee "${{ matrix.benchmark_name }}.txt"
89+
- name: Generate dry-run benchmark result
90+
if: github.event_name == 'workflow_dispatch' && inputs.dry_run && !inputs.publish
91+
run: |
92+
output="${{ matrix.benchmark_name }}.txt"
93+
printf 'test dry_run::mechanics ... bench: 1 ns/iter (+/- 0)\n' | tee "$output"
8294
- name: Upload benchmark result
8395
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
8496
with:

0 commit comments

Comments
 (0)