File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -117,11 +117,29 @@ jobs:
117117 - name : Combine metrics into a single file
118118 run : |
119119 find artifacts -name "performance_metrics.txt" -exec cat {} + > all_performance_metrics.txt
120- echo "Combined performance metrics:"
121120 sort -o all_performance_metrics.txt all_performance_metrics.txt
121+ echo "Combined performance metrics:"
122122 cat all_performance_metrics.txt
123+
124+ # Convert to JSON format suitable for github-action-benchmark
125+ echo "[" > all_performance_metrics.json
126+ first_metric=true
127+ while IFS= read -r line; do
128+ if [ "$first_metric" = false ]; then
129+ echo "," >> all_performance_metrics.json
130+ fi
131+ key=${line%:*}
132+ value=${line##*:}
133+ echo " {\"name\": \"$key\", \"value\": $value, \"unit\": \"ms\"}" >> all_performance_metrics.json
134+ first_metric=false
135+ done < all_performance_metrics.txt
136+ echo "]" >> all_performance_metrics.json
137+ echo "Combined performance metrics in JSON format:"
138+ cat all_performance_metrics.json
123139 - name : Upload combined performance metrics
124140 uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
125141 with :
126142 name : all-performance-metrics
127- path : all_performance_metrics.txt
143+ path : |
144+ all_performance_metrics.txt
145+ all_performance_metrics.json
You can’t perform that action at this time.
0 commit comments