Skip to content

Commit 114da16

Browse files
feat: add instruments-cache-dir argument
1 parent 4745cb7 commit 114da16

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ GitHub Actions for running [CodSpeed](https://codspeed.io) in your CI.
4444
# Only used if the `mongodb` instrument is enabled.
4545
mongo_uri_env_name: ""
4646

47+
# [OPTIONAL]
48+
# The directory to use for caching installations of instruments (like valgrind or perf).
49+
# This will speed up subsequent workflow runs by reusing previously installed instruments.
50+
# Defaults to $HOME/.cache/codspeed-action if not specified.
51+
instruments-cache-dir: ""
52+
4753
# [OPTIONAL]
4854
# A custom upload url, only if you are using an on premise CodSpeed instance
4955
upload-url: ""

action.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,28 @@ inputs:
4646
Comma separated list of instruments to enable. The following instruments are available:
4747
- `mongodb`: MongoDB instrumentation, requires the MongoDB instrument to be enabled for the organization in CodSpeed
4848
required: false
49+
4950
mongo-uri-env-name:
5051
description: |
5152
The name of the environment variable containing the MongoDB URI. Requires the `mongodb` instrument to be activated in `instruments`.
5253
If the instrumentation is enabled and this value is not set, the user will need to dynamically provide the MongoDB URI to the CodSpeed runner.
5354
required: false
5455

56+
instruments-cache-dir:
57+
description: |
58+
The directory to use for caching installations of instruments (like valgrind or perf). Defaults to `$HOME/.cache/codspeed-action`.
59+
required: false
60+
default: "~/.cache/codspeed-action"
61+
5562
runs:
5663
using: "composite"
5764
steps:
65+
- name: Cache CodSpeed instruments
66+
uses: actions/cache@v4
67+
with:
68+
path: ${{ inputs.instruments-cache-dir }}
69+
key: codspeed-instruments-${{ runner.os }}-${{ runner.arch }}
70+
5871
- shell: bash
5972
env:
6073
GH_MATRIX: "${{ toJson(matrix) }}"
@@ -135,6 +148,9 @@ runs:
135148
if [ -n "${{ inputs.mongo-uri-env-name }}" ]; then
136149
RUNNER_ARGS="$RUNNER_ARGS --mongo-uri-env-name=${{ inputs.mongo-uri-env-name }}"
137150
fi
151+
if [ -n "${{ inputs.instruments-cache-dir }}" ]; then
152+
RUNNER_ARGS="$RUNNER_ARGS --setup-cache-dir=${{ inputs.instruments-cache-dir }}"
153+
fi
138154
139155
# Run the benchmarks
140156
codspeed run $RUNNER_ARGS -- '${{ inputs.run }}'

0 commit comments

Comments
 (0)