Skip to content

Commit

Permalink
Codspeed
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai committed May 10, 2024
1 parent 383e67d commit 075d411
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 107 deletions.
59 changes: 24 additions & 35 deletions .github/workflows/bench_run.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
name: Benchmarks
name: MicroBenchmarks

on:
push:
branches:
- "main"
pull_request:
branches: [ main ]

# Cancel already running jobs
concurrency:
group: benchmark_run_${{ github.head_ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:

jobs:
benchmarks:
runs-on: ubuntu-20.04
name: Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
# PRs do not share caches, instead each PR initially pulls from the cache of the main branch for the first run.
# This workflow does not run on main, so to make use of a cache before this workflow has completed once on a PR,
# we need to manually recreate the key used by ubuntu-20.04 release builds.
shared-key: "ubuntu-20.04 - --release-build_check_and_upload"
save-if: false
- name: cache custom ubuntu packages
uses: actions/cache@v4
with:
path: shotover-proxy/build/packages
key: ubuntu-20.04-packages
- name: Install ubuntu packages
run: shotover-proxy/build/install_ubuntu_packages.sh
- name: Run benchmarks
run: shotover-proxy/tests/scripts/bench_against_master.sh ${{ github.event.number }}
- name: Upload comment artifact
uses: actions/upload-artifact@v4
with:
name: comment_info
path: comment_info/
- uses: actions/checkout@v3

- name: Setup rust toolchain, cache and cargo-codspeed binary
uses: moonrepo/setup-rust@v0
with:
channel: stable
cache-target: release
bins: cargo-codspeed

- name: Build the benchmark target(s)
run: cargo codspeed build

- name: Run the benchmarks
uses: CodSpeedHQ/action@v2
with:
run: cargo codspeed run
36 changes: 35 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 0 additions & 53 deletions shotover-proxy/tests/scripts/bench_against_master.sh

This file was deleted.

17 changes: 0 additions & 17 deletions shotover-proxy/tests/scripts/bench_against_master_local.sh

This file was deleted.

2 changes: 1 addition & 1 deletion shotover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ atoi = { version = "2.0.0", optional = true }
fnv = "1.0.7"

[dev-dependencies]
criterion = { version = "0.5.0", features = ["async_tokio"] }
criterion = { version = "2.6.0", features = ["async_tokio"], package = "codspeed-criterion-compat" }
hex-literal.workspace = true

# TODO: Optionally compiling benches is quite tricky with criterion, maybe it would be easier with divan?
Expand Down

0 comments on commit 075d411

Please sign in to comment.