Skip to content

Commit 0e429bd

Browse files
committed
cache valgrind and don't run apt-get update for cargo-codspeed
1 parent 5e7ddba commit 0e429bd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,26 @@ runs:
9191
if: ${{ inputs.tools }}
9292
with:
9393
tool: ${{ inputs.tools }}
94+
95+
# `cargo codspeed run` takes time to download `valgrind-codspeed` (20MB), cache it.
96+
# https://github.com/CodSpeedHQ/runner/blob/v4.0.1/src/run/runner/valgrind/setup.rs
97+
- name: Cache Valgrind .deb package
98+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # 4.3.0
99+
id: cache-valgrind
100+
if: ${{ runner.os == 'Linux' && contains(inputs.tools, 'cargo-codspeed') }}
101+
with:
102+
path: ~/valgrind-codspeed.deb
103+
key: valgrind-3.24.0-0codspeed1-ubuntu-24.04
104+
105+
- name: Download Valgrind
106+
if: ${{ runner.os == 'Linux' && contains(inputs.tools, 'cargo-codspeed') && steps.cache-valgrind.outputs.cache-hit != 'true' }}
107+
shell: bash
108+
run: |
109+
curl -L https://github.com/CodSpeedHQ/valgrind-codspeed/releases/download/3.24.0-0codspeed1/valgrind_3.24.0-0codspeed1_ubuntu-24.04_amd64.deb \
110+
-o ~/valgrind-codspeed.deb
111+
112+
# `cargo codspeed run` takes 1-2 minutes to run `cargo-codspeed`
113+
- name: Install Valgrind
114+
if: ${{ runner.os == 'Linux' && contains(inputs.tools, 'cargo-codspeed') }}
115+
shell: bash
116+
run: sudo apt-get install --allow-downgrades -y ~/valgrind-codspeed.deb

0 commit comments

Comments
 (0)