Skip to content

Commit 1885458

Browse files
authored
Merge pull request #102 from ryanoneill/fix/benchmark-ci
Add benchmark CI job with regression detection
2 parents ff80ab6 + 72a04dd commit 1885458

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,54 @@ jobs:
190190
with:
191191
path: target/doc
192192

193+
bench:
194+
name: Benchmarks
195+
runs-on: ubuntu-latest
196+
steps:
197+
- uses: actions/checkout@v4
198+
199+
- name: Install Rust
200+
uses: dtolnay/rust-toolchain@stable
201+
with:
202+
toolchain: stable
203+
204+
- name: Cache cargo registry
205+
uses: actions/cache@v4
206+
with:
207+
path: |
208+
~/.cargo/registry
209+
~/.cargo/git
210+
target
211+
key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }}
212+
restore-keys: |
213+
${{ runner.os }}-cargo-bench-
214+
215+
- name: Restore baseline
216+
uses: actions/cache@v4
217+
with:
218+
path: target/criterion
219+
key: criterion-baseline-${{ github.base_ref || 'main' }}
220+
restore-keys: |
221+
criterion-baseline-main
222+
223+
- name: Run benchmarks
224+
run: cargo bench --all-features
225+
226+
- name: Save baseline
227+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
228+
uses: actions/cache/save@v4
229+
with:
230+
path: target/criterion
231+
key: criterion-baseline-main
232+
233+
- name: Upload benchmark results
234+
if: always()
235+
uses: actions/upload-artifact@v4
236+
with:
237+
name: criterion-report
238+
path: target/criterion
239+
retention-days: 14
240+
193241
deploy-docs:
194242
name: Deploy Documentation
195243
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

0 commit comments

Comments
 (0)