Skip to content

Commit cf7fe26

Browse files
feat: make use of allow-empty in the ci of this action
1 parent 83e606b commit cf7fe26

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ jobs:
3535
- name: Check basic action execution
3636
uses: ./
3737
with:
38+
allow-empty: true
3839
mode: ${{ matrix.mode }}
3940
run: echo "Working!"
4041
- name: Check action execution with env variables
4142
uses: ./
4243
env:
4344
MY_ENV_VAR: "Hello"
4445
with:
46+
allow-empty: true
4547
mode: ${{ matrix.mode }}
4648
run: |
4749
output=$(echo "$MY_ENV_VAR")
@@ -52,13 +54,15 @@ jobs:
5254
- name: Check action in a custom directory
5355
uses: ./
5456
with:
57+
allow-empty: true
5558
mode: ${{ matrix.mode }}
5659
working-directory: examples
5760
# Check that the directory is actually changed
5861
run: if [ $(basename $(pwd)) != "examples" ]; then exit 1; fi
5962
- name: Check action with multiline command
6063
uses: ./
6164
with:
65+
allow-empty: true
6266
mode: ${{ matrix.mode }}
6367
run: |
6468
echo "Working";
@@ -70,8 +74,8 @@ jobs:
7074
matrix:
7175
version:
7276
- "latest"
73-
- "4.4.0"
74-
- "v4.4.0"
77+
- "4.4.1"
78+
- "v4.4.1"
7579

7680
runs-on: ubuntu-latest
7781
env:
@@ -81,6 +85,7 @@ jobs:
8185
- name: Check action with version format ${{ matrix.version }}
8286
uses: ./
8387
with:
88+
allow-empty: true
8489
runner-version: ${{ matrix.version }}
8590
mode: simulation
8691
run: echo "Testing version format ${{ matrix.version }}!"

action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ inputs:
6666
required: false
6767
default: "~/.cache/codspeed-action"
6868

69+
allow-empty:
70+
description: |
71+
Allow the action to complete successfully even if no benchmarks were found or run. Set to 'true' to enable this behavior.
72+
required: false
73+
default: "false"
74+
6975
runs:
7076
using: "composite"
7177
steps:
@@ -172,6 +178,9 @@ runs:
172178
if [ "${{ inputs.cache-instruments }}" = "true" ] && [ -n "${{ inputs.instruments-cache-dir }}" ]; then
173179
RUNNER_ARGS="$RUNNER_ARGS --setup-cache-dir=${{ inputs.instruments-cache-dir }}"
174180
fi
181+
if [ -n "${{ inputs.allow-empty }}" ]; then
182+
RUNNER_ARGS="$RUNNER_ARGS --allow-empty"
183+
fi
175184
176185
# Run the benchmarks
177186
codspeed run $RUNNER_ARGS -- '${{ inputs.run }}'

0 commit comments

Comments
 (0)