@@ -138,71 +138,3 @@ jobs:
138138 with :
139139 name : bench-comparison-result-${{ matrix.os }}
140140 path : ${{ env.BENCHMARK_RESULTS }}/comparison/**/*.json
141-
142- upload-benchmark-results :
143- if : (github.event_name == 'push' || github.event_name == 'pull_request') && github.repository == 'OptimumCode/json-schema-validator'
144- needs :
145- - benchmark-matrix
146- runs-on : ubuntu-latest
147- env :
148- RESULTS_DIR : bench-results
149- permissions :
150- # deployments permission to deploy GitHub pages website
151- deployments : write
152- # contents permission to update benchmark contents in gh-pages branch
153- contents : write
154- # pull-requests permission to create comments on PR in case of alert
155- pull-requests : write
156- strategy :
157- # to make sure results are submitted one by one
158- max-parallel : 1
159- matrix :
160- include :
161- - artifact-pattern : ' bench-result-*'
162- results-name : KMP JSON schema validator
163- alert : true
164- - artifact-pattern : ' bench-comparison-result-*'
165- results-name : Compare KMP JSON schema validator
166- alert : false
167- name : ' Process benchmark results for ${{ matrix.results-name }}'
168- steps :
169- - name : ' Checkout Repository'
170- uses : actions/checkout@v4
171- - name : Download benchmark results
172- uses : actions/download-artifact@v4
173- with :
174- pattern : ${{ matrix.artifact-pattern }}
175- path : ${{ env.RESULTS_DIR }}
176- merge-multiple : true
177- - name : Show downloaded artifacts
178- run : tree ${{ env.RESULTS_DIR }}
179- - name : Prepare and join benchmark reports
180- id : prep
181- run : |
182- for report in $(find ./${{ env.RESULTS_DIR }} -type f -name "*.json")
183- do
184- file_name=$(basename "$report")
185- platform="${file_name%.*}"
186- jq "[ .[] | .benchmark |= \"${platform}.\" + ltrimstr(\"io.github.optimumcode.json.schema.benchmark.\") | .params |= map_values(. |= split(\"/\")[-1]) ]" $report > ${{ env.RESULTS_DIR }}/$platform.json
187- done
188- AGGREGATED_REPORT=aggregated.json
189- # Joined reports looks like this: [[{},{}], [{},{}]]
190- # We need to transform them into this: [{},{}]
191- ls ${{ env.RESULTS_DIR }}/*.json
192- jq -s '[ .[] | .[] ]' ${{ env.RESULTS_DIR }}/*.json > $AGGREGATED_REPORT
193- echo "report=$AGGREGATED_REPORT" >> $GITHUB_OUTPUT
194- - name : Store benchmark result
195- uses : benchmark-action/github-action-benchmark@v1
196- with :
197- name : ${{ matrix.results-name }}
198- tool : ' jmh'
199- output-file-path : ${{ steps.prep.outputs.report }}
200- alert-comment-cc-users : " @OptimumCode"
201- comment-on-alert : ${{ matrix.alert }}
202- summary-always : true
203- alert-threshold : ' 150%'
204- fail-threshold : ' 200%'
205- max-items-in-chart : 50
206- github-token : ${{ secrets.GITHUB_TOKEN }}
207- # Push and deploy GitHub pages branch automatically only if run in main repo and not in PR
208- auto-push : ${{ github.event_name != 'pull_request' }}
0 commit comments