Skip to content

Commit e0e8d69

Browse files
committed
CI run benchmarks, record results, alert if threshold is exceeded
1 parent fc409e4 commit e0e8d69

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,36 @@ jobs:
196196
run: cargo +nightly update -Z minimal-versions
197197
- name: Check MSRV for core with Rust ${{ env.rust_minver }}
198198
run: cargo +${{ env.rust_minver }} check --locked --all-features --verbose
199+
200+
bench:
201+
needs: [test, check]
202+
strategy:
203+
fail-fast: false
204+
runs-on: 'ubuntu-latest'
205+
steps:
206+
- name: Checkout repository
207+
uses: actions/checkout@v4
208+
- name: Disable bench dependencies
209+
run: ./.github/workflows/disable-bench-deps.sh
210+
- name: Install Rust nightly
211+
run: rustup toolchain install nightly
212+
- name: Restore cargo caches
213+
uses: Swatinem/rust-cache@v2
214+
- name: Run benchmark
215+
run: cargo +nightly bench --features "multi-thread,runtime-pattern" --bench spdlog_rs --bench spdlog_rs_pattern | tee bench-results.txt
216+
- name: Discard irrelevant changes
217+
run: git checkout -- spdlog/Cargo.toml
218+
- name: Process results
219+
uses: benchmark-action/github-action-benchmark@v1
220+
with:
221+
name: spdlog-rs on Linux
222+
tool: cargo
223+
output-file-path: bench-results.txt
224+
benchmark-data-dir-path: docs/dev/benchmarks
225+
github-token: ${{ secrets.GITHUB_TOKEN }}
226+
summary-always: true
227+
comment-on-alert: true
228+
alert-comment-cc-users: '@SpriteOvO'
229+
- name: Push results to GitHub Pages branch
230+
if: github.event_name != 'pull_request' && (github.ref_name == 'main' || github.ref_name == 'main-dev')
231+
run: git push 'https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git' gh-pages:gh-pages

spdlog/benches/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Benchmarks
22

3+
[The tracking page] for benchmark changes for each commit during development.
4+
35
Run `cargo +nightly bench --features multi-thread` in the root directory of this repository for benchmarking.
46

57
The following results are generated with `Windows 10 64 bit` and `Intel i9-10900KF CPU @ 3.70GHz`.
@@ -281,4 +283,5 @@ test bench_5_level_off ... unavailable
281283
282284
</details>
283285
286+
[The tracking page]: https://spriteovo.github.io/spdlog-rs/dev/benchmarks/
284287
[`4cfdc8c`]: https://github.com/gabime/spdlog/commit/4cfdc8c5c84f696774cb9acde2f95c9e87c11a5e

0 commit comments

Comments
 (0)