Skip to content

Commit

Permalink
CI run benchmarks, record results, alert if threshold is exceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed Jun 12, 2024
1 parent fa27445 commit 19d207e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,36 @@ jobs:
run: cargo +nightly update -Z minimal-versions
- name: Check MSRV for core with Rust ${{ env.rust_minver }}
run: cargo +${{ env.rust_minver }} check --locked --all-features --verbose

bench:
needs: [test, check]
strategy:
fail-fast: false
runs-on: 'ubuntu-latest'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Disable bench dependencies
run: ./.github/workflows/disable-bench-deps.sh
- name: Install Rust nightly
run: rustup toolchain install nightly
- name: Restore cargo caches
uses: Swatinem/rust-cache@v2
- name: Run benchmark
run: cargo +nightly bench --features "multi-thread,runtime-pattern" --bench spdlog_rs --bench spdlog_rs_pattern | tee bench-results.txt
- name: Discard irrelevant changes
run: git checkout -- spdlog/Cargo.toml
- name: Process results
uses: benchmark-action/github-action-benchmark@v1
with:
name: spdlog-rs on Linux
tool: cargo
output-file-path: bench-results.txt
benchmark-data-dir-path: docs/dev/benchmarks
github-token: ${{ secrets.GITHUB_TOKEN }}
summary-always: true
comment-on-alert: true
alert-comment-cc-users: '@SpriteOvO'
- name: Push results to GitHub Pages branch
if: github.event_name != 'pull_request' && (github.ref_name == 'main' || github.ref_name == 'main-dev')
run: git push 'https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git' gh-pages:gh-pages
7 changes: 7 additions & 0 deletions spdlog/benches/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Benchmarks

## Development

[The tracking page] for benchmark changes for each commit during development.

## Benchmarking locally

Run `cargo +nightly bench --features multi-thread` in the root directory of this repository for benchmarking.

The following results are generated with `Windows 10 64 bit` and `Intel i9-10900KF CPU @ 3.70GHz`.
Expand Down Expand Up @@ -281,4 +287,5 @@ test bench_5_level_off ... unavailable

</details>

[The tracking page]: https://spriteovo.github.io/spdlog-rs/dev/benchmarks/
[`4cfdc8c`]: https://github.com/gabime/spdlog/commit/4cfdc8c5c84f696774cb9acde2f95c9e87c11a5e

0 comments on commit 19d207e

Please sign in to comment.