Skip to content

Commit 8baf3df

Browse files
committed
chore: fix BENCH_ARTIFACTS to run all generation
1 parent 35ad232 commit 8baf3df

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

.github/workflows/bench.yml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ jobs:
120120
failure: 'true'
121121
result: ''
122122
123+
- name: Output Result
124+
if: ${{ success() }}
125+
uses: cloudposse/github-action-matrix-outputs-write@main
126+
with:
127+
matrix-step-name: benchmark-${{ inputs.bench-file }}
128+
matrix-key: ${{ matrix.node-version }}
129+
outputs: |-
130+
result: '${{ env.BENCH_REPORT_FILE }}'
131+
123132
- name: Add Job Summary
124133
run: |
125134
result=$(cat ./${{ env.BENCH_REPORT_FILE }})
@@ -151,6 +160,42 @@ jobs:
151160
with:
152161
node-version: 22.x
153162

163+
- name: Read Matrix Outputs
164+
id: read-matrix-outputs
165+
uses: cloudposse/github-action-matrix-outputs-read@main
166+
with:
167+
matrix-step-name: benchmark-${{ inputs.bench-file }}
168+
169+
- name: Create Artifacts Mapping
170+
id: create-mapping
171+
run: |
172+
echo "Creating artifacts mapping..."
173+
# Create a key/value JSON mapping of node versions to artifact filenames
174+
MAPPING="{"
175+
first=true
176+
177+
# Get all keys from the matrix outputs
178+
keys=$(echo '${{ toJSON(steps.read-matrix-outputs.outputs) }}' | jq -r 'keys[]')
179+
180+
for key in $keys; do
181+
if [[ $key != *"failure"* ]]; then
182+
node_version=$(echo $key | sed 's/_.*//')
183+
artifact_file=$(echo '${{ toJSON(steps.read-matrix-outputs.outputs) }}' | jq -r ".[\"$key\"]")
184+
185+
if [ "$first" = true ]; then
186+
first=false
187+
else
188+
MAPPING="$MAPPING,"
189+
fi
190+
191+
MAPPING="$MAPPING\"$node_version\":\"$artifact_file\""
192+
fi
193+
done
194+
195+
MAPPING="$MAPPING}"
196+
echo "ARTIFACTS_MAPPING=$MAPPING" >> $GITHUB_ENV
197+
echo "Artifacts mapping created: $MAPPING"
198+
154199
- name: Create temporary report folder
155200
run: mkdir ./temp-reports
156201

@@ -166,7 +211,7 @@ jobs:
166211
node scripts/generate-reports.mjs
167212
env:
168213
BENCH_FILE: ${{ inputs.bench-file }}
169-
BENCH_ARTIFACTS: ${{ needs.read.outputs.result }}
214+
BENCH_ARTIFACTS: ${{ env.ARTIFACTS_MAPPING }}
170215

171216
- name: Clean temporary report folder
172217
run: rm -r ./temp-reports

0 commit comments

Comments
 (0)