From 199cd5a905ae27481ec4092270b7ba425ed4a447 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 26 Jan 2026 17:36:56 +0000 Subject: [PATCH 01/10] chore: bump runner version to 4.10.0 --- .codspeed-runner-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codspeed-runner-version b/.codspeed-runner-version index 6ed7776..2da4316 100644 --- a/.codspeed-runner-version +++ b/.codspeed-runner-version @@ -1 +1 @@ -4.9.0 +4.10.0 From 9e58dbca18a92ded9c52a4bbd89e840755bed5b0 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 26 Jan 2026 15:44:58 +0100 Subject: [PATCH 02/10] feat: make `run` optional to use `codspeed.yml` --- README.md | 6 +++++- action.yml | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dda0933..88b80c3 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,12 @@ GitHub Actions for running [CodSpeed](https://codspeed.io) in your CI. ```yaml - uses: CodSpeedHQ/action@v4 with: - # [REQUIRED] + # [OPTIONAL] # The command used to run your CodSpeed benchmarks + # + # Leave empty to use targets defined in your project configuration (e.g `codspeed.yml`) + # https://codspeed.io/docs/cli#configuration + # ⚠️ WARNING: for action/runner versions lower than v4.9.0, this parameter is required. run: "" # [REQUIRED] diff --git a/action.yml b/action.yml index 0ee33d7..d694c55 100644 --- a/action.yml +++ b/action.yml @@ -8,7 +8,7 @@ author: "Arthur Pastel" inputs: run: description: "The command to run the benchmarks" - required: true + required: false mode: description: | @@ -107,6 +107,8 @@ runs: env: GH_MATRIX: "${{ toJson(matrix) }}" GH_STRATEGY: "${{ toJson(strategy) }}" + # This is needed to properly handle quotes and multiline commands in the 'run' input properly, rather than doing `RUN_INPUT_RUN=${{ inputs.run }}` in the script + CODSPEED_INPUT_RUN: ${{ inputs.run }} run: | # Validate required inputs # (custom message for smoother v4 migration) @@ -191,4 +193,8 @@ runs: fi # Run the benchmarks - codspeed run $RUNNER_ARGS -- '${{ inputs.run }}' + if [ -n "$CODSPEED_INPUT_RUN" ]; then + codspeed run $RUNNER_ARGS -- "$CODSPEED_INPUT_RUN" + else + codspeed run $RUNNER_ARGS + fi From 86c3398e3a2fffa6bee98e59f3721750fc0d4013 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 26 Jan 2026 16:27:55 +0100 Subject: [PATCH 03/10] feat: add config input --- README.md | 5 +++++ action.yml | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 88b80c3..263069b 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,11 @@ GitHub Actions for running [CodSpeed](https://codspeed.io) in your CI. # ⚠️ WARNING: if you use `defaults.run.working-directory`, you must still set this parameter. working-directory: "" + # [OPTIONAL] + # Path to a CodSpeed configuration file (codspeed.yml). + # If not specified, the runner will look for a codspeed.yml file in the repository root. + config: "" + # [OPTIONAL] # Comma-separated list of instruments to enable. Possible values: mongodb. instruments: "" diff --git a/action.yml b/action.yml index d694c55..aeb6fd8 100644 --- a/action.yml +++ b/action.yml @@ -77,6 +77,10 @@ inputs: description: "The version of the go-runner to use (e.g., 1.0.0, 1.0.0-beta.1). If not specified, the latest version will be installed" required: false + config: + description: "Path to a CodSpeed configuration file (codspeed.yml). If not specified, the runner will look for a codspeed.yml file in the repository root." + required: false + runs: using: "composite" steps: @@ -191,6 +195,9 @@ runs: if [ -n "${{ inputs.go-runner-version }}" ]; then RUNNER_ARGS="$RUNNER_ARGS --go-runner-version=${{ inputs.go-runner-version }}" fi + if [ -n "${{ inputs.config }}" ]; then + RUNNER_ARGS="$RUNNER_ARGS --config=${{ inputs.config }}" + fi # Run the benchmarks if [ -n "$CODSPEED_INPUT_RUN" ]; then From a8ac9aa911993a2d0896f91cebc3cba176b1ab10 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 26 Jan 2026 17:41:00 +0100 Subject: [PATCH 04/10] ci: print output in env var test success --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af69b24..5b281bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,8 @@ jobs: if [ "$output" != "Hello" ]; then echo "Assertion failed: Expected 'Hello' but got '$output'" exit 1 + else + echo "Environment variable check passed with $output." fi - name: Check action in a custom directory uses: ./ From 7c198462dca5477e787694f834427acd17730933 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 26 Jan 2026 17:47:35 +0100 Subject: [PATCH 05/10] ci: add config file test --- .github/test-codspeed.yml | 5 +++++ .github/workflows/ci.yml | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 .github/test-codspeed.yml diff --git a/.github/test-codspeed.yml b/.github/test-codspeed.yml new file mode 100644 index 0000000..a6d1aa6 --- /dev/null +++ b/.github/test-codspeed.yml @@ -0,0 +1,5 @@ +benchmarks: + - name: "test" + exec: echo "Working!" + - name: "test2" + exec: echo "Also working!" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b281bd..4c6917d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,3 +113,16 @@ jobs: go-runner-version: ${{ matrix.version }} mode: walltime run: echo "Testing version format ${{ matrix.version }}!" + + test-config-file: + runs-on: ubuntu-latest + env: + CODSPEED_SKIP_UPLOAD: true + steps: + - uses: actions/checkout@v4 + - run: cat .github/test-codspeed.yml + - name: Check action with config file (no run input) + uses: ./ + with: + mode: memory + config: .github/test-codspeed.yml From 39945d98c77337c1bdc5831d066d7113626f3e11 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 26 Jan 2026 19:00:37 +0100 Subject: [PATCH 06/10] chore: test --- action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index aeb6fd8..933b65f 100644 --- a/action.yml +++ b/action.yml @@ -199,9 +199,9 @@ runs: RUNNER_ARGS="$RUNNER_ARGS --config=${{ inputs.config }}" fi - # Run the benchmarks if [ -n "$CODSPEED_INPUT_RUN" ]; then - codspeed run $RUNNER_ARGS -- "$CODSPEED_INPUT_RUN" - else - codspeed run $RUNNER_ARGS + RUNNER_ARGS="$RUNNER_ARGS -- $CODSPEED_INPUT_RUN" fi + + # Run the benchmarks + codspeed run $RUNNER_ARGS From 815ee55f1f6830b343195adc75c00bc6c4e26a27 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 26 Jan 2026 19:05:33 +0100 Subject: [PATCH 07/10] test: with single quotes --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 933b65f..26bb708 100644 --- a/action.yml +++ b/action.yml @@ -200,7 +200,7 @@ runs: fi if [ -n "$CODSPEED_INPUT_RUN" ]; then - RUNNER_ARGS="$RUNNER_ARGS -- $CODSPEED_INPUT_RUN" + RUNNER_ARGS="$RUNNER_ARGS -- '$CODSPEED_INPUT_RUN'" fi # Run the benchmarks From bb18bd8bac47db154c4cb6ba5d1bbc4adcae9978 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 26 Jan 2026 19:07:12 +0100 Subject: [PATCH 08/10] test with escaped double quotes --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 26bb708..b05bb7e 100644 --- a/action.yml +++ b/action.yml @@ -200,7 +200,7 @@ runs: fi if [ -n "$CODSPEED_INPUT_RUN" ]; then - RUNNER_ARGS="$RUNNER_ARGS -- '$CODSPEED_INPUT_RUN'" + RUNNER_ARGS="$RUNNER_ARGS -- \"$CODSPEED_INPUT_RUN\"" fi # Run the benchmarks From 9012fdff7a2fa07d07ee12d5e3aa0b821e177ded Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 26 Jan 2026 19:09:36 +0100 Subject: [PATCH 09/10] no escaped --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b05bb7e..933b65f 100644 --- a/action.yml +++ b/action.yml @@ -200,7 +200,7 @@ runs: fi if [ -n "$CODSPEED_INPUT_RUN" ]; then - RUNNER_ARGS="$RUNNER_ARGS -- \"$CODSPEED_INPUT_RUN\"" + RUNNER_ARGS="$RUNNER_ARGS -- $CODSPEED_INPUT_RUN" fi # Run the benchmarks From 76c5533c1148b13311149d9ab4b004764d24b2cd Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 26 Jan 2026 19:13:18 +0100 Subject: [PATCH 10/10] test --- action.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/action.yml b/action.yml index 933b65f..c9f562d 100644 --- a/action.yml +++ b/action.yml @@ -166,42 +166,42 @@ runs: fi fi - # Get the runner arguments - RUNNER_ARGS="" + # Build the runner arguments array + RUNNER_ARGS=() if [ -n "${{ inputs.token }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --token ${{ inputs.token }}" + RUNNER_ARGS+=(--token "${{ inputs.token }}") fi if [ -n "${{ inputs.working-directory }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --working-directory=${{ inputs.working-directory }}" + RUNNER_ARGS+=(--working-directory="${{ inputs.working-directory }}") fi if [ -n "${{ inputs.upload-url }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --upload-url=${{ inputs.upload-url }}" + RUNNER_ARGS+=(--upload-url="${{ inputs.upload-url }}") fi if [ -n "${{ inputs.mode }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --mode=${{ inputs.mode }}" + RUNNER_ARGS+=(--mode="${{ inputs.mode }}") fi if [ -n "${{ inputs.instruments }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --instruments=${{ inputs.instruments }}" + RUNNER_ARGS+=(--instruments="${{ inputs.instruments }}") fi if [ -n "${{ inputs.mongo-uri-env-name }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --mongo-uri-env-name=${{ inputs.mongo-uri-env-name }}" + RUNNER_ARGS+=(--mongo-uri-env-name="${{ inputs.mongo-uri-env-name }}") fi if [ "${{ inputs.cache-instruments }}" = "true" ] && [ -n "${{ inputs.instruments-cache-dir }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --setup-cache-dir=${{ inputs.instruments-cache-dir }}" + RUNNER_ARGS+=(--setup-cache-dir="${{ inputs.instruments-cache-dir }}") fi if [ "${{ inputs.allow-empty }}" = "true" ]; then - RUNNER_ARGS="$RUNNER_ARGS --allow-empty" + RUNNER_ARGS+=(--allow-empty) fi if [ -n "${{ inputs.go-runner-version }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --go-runner-version=${{ inputs.go-runner-version }}" + RUNNER_ARGS+=(--go-runner-version="${{ inputs.go-runner-version }}") fi if [ -n "${{ inputs.config }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --config=${{ inputs.config }}" + RUNNER_ARGS+=(--config="${{ inputs.config }}") fi if [ -n "$CODSPEED_INPUT_RUN" ]; then - RUNNER_ARGS="$RUNNER_ARGS -- $CODSPEED_INPUT_RUN" + RUNNER_ARGS+=(-- "$CODSPEED_INPUT_RUN") fi # Run the benchmarks - codspeed run $RUNNER_ARGS + codspeed run "${RUNNER_ARGS[@]}"