50
50
matrix :
51
51
include :
52
52
- os : ubuntu-latest
53
- additional-task : ' '
53
+ additional-task : ' :benchmark:jvmComparisonBenchmark '
54
54
- os : macos-latest
55
55
additional-task : ' -x :benchmark:jvmBenchmark'
56
56
- os : macos-13 # for macosX64
59
59
additional-task : ' -x :benchmark:jvmBenchmark'
60
60
runs-on : ${{ matrix.os }}
61
61
name : Run benchmarks on ${{ matrix.os }}
62
+ env :
63
+ BENCHMARK_RESULTS : ' benchmark/build/reports/benchmarks'
62
64
steps :
63
65
- name : ' Install native dependencies'
64
66
run : sudo apt-get install -y libunistring-dev
@@ -107,7 +109,7 @@ jobs:
107
109
shell : bash
108
110
if : env.REPORT_FORMAT == 'csv'
109
111
run : |
110
- for report in $(find ./benchmark/build/reports/benchmarks/main -type f -name "*.csv")
112
+ for report in $(find ./${{ env.BENCHMARK_RESULTS }} -type f -name "*.csv")
111
113
do
112
114
file_name=$(basename "$report")
113
115
platform="${file_name%.*}"
@@ -129,7 +131,13 @@ jobs:
129
131
uses : actions/upload-artifact@v4
130
132
with :
131
133
name : bench-result-${{ matrix.os }}
132
- path : benchmark/build/reports/benchmarks/main/**/*.json
134
+ path : ${{ env.BENCHMARK_RESULTS }}/main/**/*.json
135
+ - name : Store comparison results as artifact
136
+ if : env.REPORT_FORMAT == 'json' && matrix.os == 'ubuntu-latest'
137
+ uses : actions/upload-artifact@v4
138
+ with :
139
+ name : bench-comparison-result-${{ matrix.os }}
140
+ path : ${{ env.BENCHMARK_RESULTS }}/comparison/**/*.json
133
141
134
142
upload-benchmark-results :
135
143
if : (github.event_name == 'push' || github.event_name == 'pull_request') && github.repository == 'OptimumCode/json-schema-validator'
@@ -145,12 +153,25 @@ jobs:
145
153
contents : write
146
154
# pull-requests permission to create comments on PR in case of alert
147
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 }}'
148
168
steps :
149
169
- name : ' Checkout Repository'
150
170
uses : actions/checkout@v4
151
171
- name : Download benchmark results
152
172
uses : actions/download-artifact@v4
153
173
with :
174
+ pattern : ${{ matrix.artifact-pattern }}
154
175
path : ${{ env.RESULTS_DIR }}
155
176
merge-multiple : true
156
177
- name : Show downloaded artifacts
@@ -173,14 +194,14 @@ jobs:
173
194
- name : Store benchmark result
174
195
uses : benchmark-action/github-action-benchmark@v1
175
196
with :
176
- name : KMP JSON schema validator
197
+ name : ${{ matrix.results-name }}
177
198
tool : ' jmh'
178
199
output-file-path : ${{ steps.prep.outputs.report }}
179
200
alert-comment-cc-users : " @OptimumCode"
180
- comment-on-alert : true
201
+ comment-on-alert : ${{ matrix.alert }}
181
202
summary-always : true
182
- alert-threshold : ' 50 %'
183
- fail-threshold : ' 100 %'
203
+ alert-threshold : ' 150 %'
204
+ fail-threshold : ' 200 %'
184
205
max-items-in-chart : 50
185
206
github-token : ${{ secrets.GITHUB_TOKEN }}
186
207
# Push and deploy GitHub pages branch automatically only if run in main repo and not in PR
0 commit comments