Skip to content

Commit 2c36a70

Browse files
committed
ci: cache runner builds across memtrack benchmark shards
Install codspeed-runner and memtrack once via baptiste0928/cargo-install, pointed at a shared cached target directory, and let the runner action handle instrument caching and benchmark execution instead of a separate debug build.
1 parent 8961932 commit 2c36a70

1 file changed

Lines changed: 28 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ jobs:
164164
workload: [ls, dd, tar]
165165
env:
166166
CODSPEED_REV: ${{ github.event.pull_request.head.sha || github.sha }}
167+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
167168
steps:
168169
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
169170
with:
@@ -173,13 +174,35 @@ jobs:
173174
- uses: ./.github/actions/install-bpf-deps
174175

175176
- name: Install memtrack
176-
run: cargo install --git https://github.com/CodSpeedHQ/codspeed --rev "$CODSPEED_REV" --locked memtrack
177+
uses: baptiste0928/cargo-install@8195d4f734a149db85385bb4102b42efcd373759 # v3.5.0
178+
with:
179+
crate: memtrack
180+
git: https://github.com/CodSpeedHQ/codspeed
181+
commit: ${{ env.CODSPEED_REV }}
177182

178-
- name: Grant memtrack file capabilities
179-
run: cargo r -- setup --mode memory
183+
- name: Install codspeed-runner
184+
uses: baptiste0928/cargo-install@8195d4f734a149db85385bb4102b42efcd373759 # v3.5.0
185+
with:
186+
crate: codspeed-runner
187+
git: https://github.com/CodSpeedHQ/codspeed
188+
commit: ${{ env.CODSPEED_REV }}
180189

181-
- name: Verify memtrack binary
182-
run: codspeed-memtrack --version
190+
# The CodSpeed action reinstalls the runner into CARGO_INSTALL_ROOT; pointing
191+
# it at the cached install root makes cargo see the same revision as already
192+
# installed and skip the rebuild.
193+
- name: Reuse the cached runner install
194+
run: echo "CARGO_INSTALL_ROOT=$HOME/.cargo-install/codspeed-runner" >> "$GITHUB_ENV"
195+
196+
- name: Verify installed binaries
197+
run: |
198+
which codspeed codspeed-memtrack
199+
codspeed --version
200+
codspeed-memtrack --version
201+
202+
# The benchmarked command is memtrack itself, which needs file capabilities
203+
# to load its eBPF programs regardless of the mode the runner measures in.
204+
- name: Grant memtrack file capabilities
205+
run: codspeed setup --mode memory
183206

184207
# The write benchmarks overwrite these files every round; creating them
185208
# inside a measured round would time one-off disk allocation.

0 commit comments

Comments
 (0)