From d18d8008e92e96c18915b1f97e048dfdead7dd9a Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Fri, 26 Jul 2024 11:55:14 +0200 Subject: [PATCH] Add codspeed --- .github/workflows/test.yml | 40 ++++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 +- benches/incremental.rs | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80bfbbbd..723f8b68 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,3 +89,43 @@ jobs: - name: Run examples with Miri run: | cargo miri run --example calc + + benchmarks: + name: Benchmarks + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: dtolnay/rust-toolchain@master + id: rust-toolchain + with: + toolchain: stable + + - name: "Setup codspeed" + uses: taiki-e/install-action@v2 + with: + tool: cargo-codspeed + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}- + ${{ runner.os }}-cargo- + + - name: "Build benchmarks" + run: cargo codspeed build + + - name: "Run benchmarks" + uses: CodSpeedHQ/action@v2 + with: + run: cargo codspeed run + token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index c6a369cf..395d0098 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ smallvec = "1.0.0" [dev-dependencies] annotate-snippets = "0.11.4" -criterion = "0.5.1" +codspeed-criterion-compat = { version = "2.6.0", default-features = false } derive-new = "0.5.9" expect-test = "1.4.0" eyre = "0.6.8" diff --git a/benches/incremental.rs b/benches/incremental.rs index a73efea2..101e6d01 100644 --- a/benches/incremental.rs +++ b/benches/incremental.rs @@ -1,4 +1,4 @@ -use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; +use codspeed_criterion_compat::{criterion_group, criterion_main, BatchSize, Criterion}; use salsa::Setter; #[salsa::input]