From 27e3146ec54d99d51eb37994f5ffdf2c38350106 Mon Sep 17 00:00:00 2001 From: Kim Gustyr Date: Fri, 30 Oct 2026 22:23:10 +0100 Subject: [PATCH] ci: Build CodSpeed benchmarks outside the simulation CodSpeed's simulation mode runs the action's whole command under Valgrind, so compiling cargo-codspeed and the benchmarks there took ~40 minutes, against ~30 seconds for the benchmarks themselves. --- .github/workflows/codspeed.yml | 7 ++++++- Makefile | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index eed2eed..70052a8 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -29,8 +29,13 @@ jobs: channel: stable cache-target: release + - name: Build benchmarks + run: make benchmark-build + env: + CODSPEED_RUNNER_MODE: ${{ vars.CODSPEED_MODE }} # Set by the CodSpeed action for benchmark-run + - name: Run benchmarks uses: CodSpeedHQ/action@78102a468f96d8e0ccb92d0ec49425753fc42062 # v5.6.0 with: mode: ${{ vars.CODSPEED_MODE }} - run: make benchmark + run: make benchmark-run diff --git a/Makefile b/Makefile index 37b512a..39342b0 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,13 @@ SDK_BENCHMARKS := benchmarks/fixtures/sdk-benchmarks $(SDK_BENCHMARKS)/environments: git submodule update --init -- $(SDK_BENCHMARKS) -.PHONY: benchmark -benchmark: | $(SDK_BENCHMARKS)/environments +.PHONY: benchmark benchmark-build benchmark-run +benchmark: benchmark-build benchmark-run + +# Kept apart from benchmark-run: CodSpeed's simulation mode runs its whole command under Valgrind +benchmark-build: | $(SDK_BENCHMARKS)/environments cargo install --locked cargo-codspeed@$(CARGO_CODSPEED_VERSION) cd benchmarks && cargo codspeed build --locked + +benchmark-run: | $(SDK_BENCHMARKS)/environments cd benchmarks && SDK_BENCHMARKS_ENVIRONMENTS=$(CURDIR)/$(SDK_BENCHMARKS)/environments cargo codspeed run