From 250c02b00bcd9f956be8b70eb957200526ad95a1 Mon Sep 17 00:00:00 2001 From: Adrien Cacciaguerra Date: Thu, 2 May 2024 15:39:44 -0400 Subject: [PATCH] feat: add CodSpeed to the project --- .github/workflows/benchmark.yml | 36 +++++++++++++++++++++++++++++++++ neqo-bin/Cargo.toml | 2 +- neqo-common/Cargo.toml | 2 +- neqo-transport/Cargo.toml | 2 +- 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000000..5117ecd2ed --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,36 @@ +name: codspeed-benchmarks + +on: + # Run on pushes to the main branch + push: + branches: + - "main" + # Run on pull requests + pull_request: + # `workflow_dispatch` allows CodSpeed to trigger backtest + # performance analysis in order to generate initial data. + workflow_dispatch: + +jobs: + benchmarks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup rust toolchain, cache and cargo-codspeed binary + uses: moonrepo/setup-rust@v1 + with: + cache-target: release + bins: cargo-codspeed + + - name: Fetch and build NSS and NSPR + uses: ./.github/actions/nss + + - name: Build the benchmark target(s) + run: | + cargo codspeed build --workspace --exclude neqo-common --features bench + cargo codspeed build -p neqo-common + + - name: Run the benchmarks + uses: CodSpeedHQ/action@v2 + with: + run: cargo codspeed run diff --git a/neqo-bin/Cargo.toml b/neqo-bin/Cargo.toml index 145f7ac386..d93a47fb9e 100644 --- a/neqo-bin/Cargo.toml +++ b/neqo-bin/Cargo.toml @@ -41,7 +41,7 @@ tokio = { version = "1", default-features = false, features = ["net", "time", "m url = { version = "2.5", default-features = false } [dev-dependencies] -criterion = { version = "0.5", default-features = false, features = ["html_reports", "async_tokio"] } +criterion = { package="codspeed-criterion-compat", version = "2.6.0", default-features = false, features = ["html_reports", "async_tokio"] } tokio = { version = "1", default-features = false, features = ["sync"] } [features] diff --git a/neqo-common/Cargo.toml b/neqo-common/Cargo.toml index a70b3738d5..cae03d7746 100644 --- a/neqo-common/Cargo.toml +++ b/neqo-common/Cargo.toml @@ -22,7 +22,7 @@ qlog = { workspace = true } time = { version = "0.3", default-features = false, features = ["formatting"] } [dev-dependencies] -criterion = { version = "0.5", default-features = false, features = ["html_reports"] } +criterion = { package="codspeed-criterion-compat", version = "2.6.0", default-features = false, features = ["html_reports"] } test-fixture = { path = "../test-fixture" } [features] diff --git a/neqo-transport/Cargo.toml b/neqo-transport/Cargo.toml index 2abdbbfd95..6a8d882045 100644 --- a/neqo-transport/Cargo.toml +++ b/neqo-transport/Cargo.toml @@ -22,7 +22,7 @@ qlog = { workspace = true } smallvec = { version = "1.11", default-features = false } [dev-dependencies] -criterion = { version = "0.5", default-features = false, features = ["html_reports"] } +criterion = { package="codspeed-criterion-compat", version = "2.6.0", default-features = false, features = ["html_reports"] } test-fixture = { path = "../test-fixture" } [features]