Skip to content

Commit f12693f

Browse files
committed
feat: add skip_benchmark input to daily-benchmark.yml for flexible job execution
- Introduced an input parameter `skip_benchmark` to allow users to skip the benchmark job during manual triggers. - Updated job dependencies and conditions to handle cases where the benchmark is skipped, ensuring the analysis job can still run based on previous results. - Enhanced environment variable handling to set empty results when benchmarks are skipped, improving workflow robustness.
1 parent b08b133 commit f12693f

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/workflows/daily-benchmark.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
schedule:
55
- cron: '0 6 * * *' # Run daily at 6 AM UTC
66
workflow_dispatch: # Allow manual triggers
7+
inputs:
8+
skip_benchmark:
9+
description: 'Skip benchmark job (for testing analysis/publish only)'
10+
required: false
11+
default: false
12+
type: boolean
713

814
jobs:
915
setup:
@@ -55,6 +61,7 @@ jobs:
5561
benchmark:
5662
runs-on: ubuntu-latest
5763
needs: setup
64+
if: ${{ !inputs.skip_benchmark }}
5865
outputs:
5966
results-available: ${{ steps.benchmark.conclusion == 'success' }}
6067
steps:
@@ -105,8 +112,8 @@ jobs:
105112

106113
analysis:
107114
runs-on: ubuntu-latest
108-
needs: benchmark
109-
if: needs.benchmark.outputs.results-available != 'false'
115+
needs: [setup, benchmark]
116+
if: ${{ always() && (inputs.skip_benchmark || needs.benchmark.outputs.results-available != 'false') }}
110117
outputs:
111118
readme-updated: ${{ steps.compare.outputs.readme-updated }}
112119
performance-regression: ${{ steps.compare.outputs.performance-regression }}
@@ -133,16 +140,23 @@ jobs:
133140
path: dist/
134141

135142
- name: Download benchmark results
143+
if: ${{ !inputs.skip_benchmark }}
136144
uses: actions/download-artifact@v4
137145
with:
138146
name: benchmark-results
139147

140148
- name: Read current results
149+
if: ${{ !inputs.skip_benchmark }}
141150
run: |
142151
echo "RESULTS_JSON<<EOF" >> $GITHUB_ENV
143152
cat benchmark-results.json >> $GITHUB_ENV
144153
echo "EOF" >> $GITHUB_ENV
145154
155+
- name: Set empty results when benchmark skipped
156+
if: ${{ inputs.skip_benchmark }}
157+
run: |
158+
echo "RESULTS_JSON={}" >> $GITHUB_ENV
159+
146160
- name: Read previous results
147161
id: previous-results
148162
run: |
@@ -174,6 +188,7 @@ jobs:
174188
PREVIOUS_RESULTS: ${{ env.PREVIOUS_RESULTS_JSON }}
175189

176190
- name: Save current results
191+
if: ${{ !inputs.skip_benchmark }}
177192
run: |
178193
cp benchmark-results.json previous-benchmark-results.json
179194
@@ -222,6 +237,7 @@ jobs:
222237
name: analysis-results
223238

224239
- name: Download benchmark results
240+
if: ${{ !inputs.skip_benchmark }}
225241
uses: actions/download-artifact@v4
226242
with:
227243
name: benchmark-results

0 commit comments

Comments
 (0)