Skip to content

Commit a6c4f1c

Browse files
authored
fix: 231 rust bench not comparing to baseline (#235)
* sort jobs in ci workflows * add missing benches to ci jobs * rename CriterionRS bench to distinguish between default Rust and Criterion benchmarks
1 parent e7180f5 commit a6c4f1c

File tree

6 files changed

+275
-169
lines changed

6 files changed

+275
-169
lines changed

.github/workflows/ci-results-repo.yml

+151-77
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ on:
88
- master
99

1010
jobs:
11-
rust:
12-
name: Run Rust benchmark example - github.com/benchmark-action/github-action-benchmark-results
11+
benchmarkdotnet-framework:
12+
name: Run Benchmark.Net .Net Benchmark Framework example - github.com/benchmark-action/github-action-benchmark-results
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16+
- uses: actions/setup-dotnet@v3
17+
with:
18+
dotnet-version: '6.0.101' # SDK Version to use. keep in line with examples/benchmarkdotnet/global.json
1619
- uses: actions/setup-node@v4
1720
with:
1821
node-version: 20
1922
cache: 'npm'
2023
- run: npm ci
2124
- run: npm run build
22-
- run: rustup toolchain update nightly && rustup default nightly
2325
- name: Run benchmark
24-
run: cd examples/rust && cargo +nightly bench | tee output.txt
26+
run: cd examples/benchmarkdotnet && dotnet run --exporters json --filter '*'
2527

2628
- uses: actions/checkout@v4
2729
with:
@@ -35,30 +37,27 @@ jobs:
3537
- name: Store benchmark result
3638
uses: ./
3739
with:
38-
name: Rust Benchmark
39-
tool: 'cargo'
40-
output-file-path: examples/rust/output.txt
40+
name: Benchmark.Net Benchmark
41+
tool: 'benchmarkdotnet'
42+
output-file-path: examples/benchmarkdotnet/BenchmarkDotNet.Artifacts/results/Sample.Benchmarks-report-full-compressed.json
4143
fail-on-alert: true
4244
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
4345
github-token: ${{ secrets.GITHUB_TOKEN }}
44-
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Rust Benchmark' './benchmark-data-repository'
46+
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Benchmark.Net Benchmark' './benchmark-data-repository'
4547

46-
go:
47-
name: Run Go benchmark example - github.com/benchmark-action/github-action-benchmark-results
48+
benchmarkjs:
49+
name: Run JavaScript benchmark example - github.com/benchmark-action/github-action-benchmark-results
4850
runs-on: ubuntu-latest
4951
steps:
5052
- uses: actions/checkout@v4
5153
- uses: actions/setup-node@v4
5254
with:
5355
node-version: 20
5456
cache: 'npm'
55-
- uses: actions/setup-go@v4
56-
with:
57-
go-version: "stable"
5857
- run: npm ci
5958
- run: npm run build
6059
- name: Run benchmark
61-
run: cd examples/go && go test -bench 'BenchmarkFib' | tee output.txt
60+
run: cd examples/benchmarkjs && npm install && node bench.js | tee output.txt
6261

6362
- uses: actions/checkout@v4
6463
with:
@@ -72,17 +71,17 @@ jobs:
7271
- name: Store benchmark result
7372
uses: ./
7473
with:
75-
name: Go Benchmark
76-
tool: 'go'
77-
output-file-path: examples/go/output.txt
74+
name: Benchmark.js Benchmark
75+
tool: 'benchmarkjs'
76+
output-file-path: examples/benchmarkjs/output.txt
7877
fail-on-alert: true
7978
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
8079
github-token: ${{ secrets.GITHUB_TOKEN }}
81-
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Go Benchmark' './benchmark-data-repository'
80+
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Benchmark.js Benchmark' './benchmark-data-repository'
8281

83-
benchmarkjs:
84-
name: Run JavaScript benchmark example - github.com/benchmark-action/github-action-benchmark-results
85-
runs-on: ubuntu-latest
82+
catch2-framework:
83+
name: Run Catch2 C++ Benchmark Framework example - github.com/benchmark-action/github-action-benchmark-results
84+
runs-on: ubuntu-20.04
8685
steps:
8786
- uses: actions/checkout@v4
8887
- uses: actions/setup-node@v4
@@ -92,7 +91,12 @@ jobs:
9291
- run: npm ci
9392
- run: npm run build
9493
- name: Run benchmark
95-
run: cd examples/benchmarkjs && npm install && node bench.js | tee output.txt
94+
run: |
95+
cd examples/catch2
96+
mkdir build && cd build
97+
cmake -DCMAKE_BUILD_TYPE=Release ..
98+
cmake --build . --config Release
99+
./Catch2_bench > ../benchmark_result.txt
96100
97101
- uses: actions/checkout@v4
98102
with:
@@ -106,33 +110,34 @@ jobs:
106110
- name: Store benchmark result
107111
uses: ./
108112
with:
109-
name: Benchmark.js Benchmark
110-
tool: 'benchmarkjs'
111-
output-file-path: examples/benchmarkjs/output.txt
113+
name: Catch2 Benchmark
114+
tool: 'catch2'
115+
output-file-path: examples/catch2/benchmark_result.txt
112116
fail-on-alert: true
113117
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
114118
github-token: ${{ secrets.GITHUB_TOKEN }}
115-
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Benchmark.js Benchmark' './benchmark-data-repository'
119+
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Catch2 Benchmark' './benchmark-data-repository'
116120

117-
pytest-benchmark:
118-
name: Run Pytest benchmark example - github.com/benchmark-action/github-action-benchmark-results
119-
runs-on: ubuntu-latest
121+
cpp-framework:
122+
name: Run Google C++ Benchmark Framework example - github.com/benchmark-action/github-action-benchmark-results
123+
runs-on: ubuntu-20.04
120124
steps:
121125
- uses: actions/checkout@v4
122126
- uses: actions/setup-node@v4
123127
with:
124128
node-version: 20
125129
cache: 'npm'
126-
- uses: actions/setup-python@v5
127-
with:
128-
python-version: 3.9
129130
- run: npm ci
130131
- run: npm run build
132+
- name: Cache Benchmark library
133+
uses: actions/cache@v4
134+
with:
135+
path: examples/cpp/benchmark
136+
key: ${{ runner.os }}-googlebenchmark-v1.5.0
131137
- name: Run benchmark
132138
run: |
133-
cd examples/pytest
134-
pip install -r requirements.txt
135-
pytest bench.py --benchmark-json output.json
139+
cd examples/cpp
140+
make json
136141
137142
- uses: actions/checkout@v4
138143
with:
@@ -146,34 +151,30 @@ jobs:
146151
- name: Store benchmark result
147152
uses: ./
148153
with:
149-
name: Python Benchmark with pytest-benchmark
150-
tool: 'pytest'
151-
output-file-path: examples/pytest/output.json
154+
name: C++ Benchmark
155+
tool: 'googlecpp'
156+
output-file-path: examples/cpp/benchmark_result.json
152157
fail-on-alert: true
153158
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
154159
github-token: ${{ secrets.GITHUB_TOKEN }}
155-
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Python Benchmark with pytest-benchmark' './benchmark-data-repository'
160+
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'C++ Benchmark' './benchmark-data-repository'
156161

157-
google-benchmark-framework:
158-
name: Run Google C++ Benchmark Framework example - github.com/benchmark-action/github-action-benchmark-results
159-
runs-on: ubuntu-20.04
162+
go:
163+
name: Run Go benchmark example - github.com/benchmark-action/github-action-benchmark-results
164+
runs-on: ubuntu-latest
160165
steps:
161166
- uses: actions/checkout@v4
162167
- uses: actions/setup-node@v4
163168
with:
164169
node-version: 20
165170
cache: 'npm'
171+
- uses: actions/setup-go@v4
172+
with:
173+
go-version: "stable"
166174
- run: npm ci
167175
- run: npm run build
168-
- name: Cache Benchmark library
169-
uses: actions/cache@v4
170-
with:
171-
path: examples/cpp/benchmark
172-
key: ${{ runner.os }}-googlebenchmark-v1.5.0
173176
- name: Run benchmark
174-
run: |
175-
cd examples/cpp
176-
make json
177+
run: cd examples/go && go test -bench 'BenchmarkFib' | tee output.txt
177178

178179
- uses: actions/checkout@v4
179180
with:
@@ -187,33 +188,34 @@ jobs:
187188
- name: Store benchmark result
188189
uses: ./
189190
with:
190-
name: C++ Benchmark
191-
tool: 'googlecpp'
192-
output-file-path: examples/cpp/benchmark_result.json
191+
name: Go Benchmark
192+
tool: 'go'
193+
output-file-path: examples/go/output.txt
193194
fail-on-alert: true
194195
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
195196
github-token: ${{ secrets.GITHUB_TOKEN }}
196-
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'C++ Benchmark' './benchmark-data-repository'
197+
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Go Benchmark' './benchmark-data-repository'
197198

198-
catch2-framework:
199-
name: Run Catch2 C++ Benchmark Framework example - github.com/benchmark-action/github-action-benchmark-results
200-
runs-on: ubuntu-20.04
199+
java-jmh:
200+
name: Run JMH Java Benchmark Framework example
201+
runs-on: ubuntu-latest
201202
steps:
202203
- uses: actions/checkout@v4
203204
- uses: actions/setup-node@v4
204205
with:
205206
node-version: 20
206207
cache: 'npm'
208+
- uses: actions/setup-java@v4
209+
with:
210+
distribution: 'adopt'
211+
java-version: '11'
207212
- run: npm ci
208213
- run: npm run build
209214
- name: Run benchmark
210215
run: |
211-
cd examples/catch2
212-
mkdir build && cd build
213-
cmake -DCMAKE_BUILD_TYPE=Release ..
214-
cmake --build . --config Release
215-
./Catch2_bench > ../benchmark_result.txt
216-
216+
cd examples/java
217+
mvn clean verify
218+
java -jar target/benchmarks.jar -wi 1 -i 3 -f 1 -rf json
217219
- uses: actions/checkout@v4
218220
with:
219221
repository: benchmark-action/github-action-benchmark-results
@@ -222,17 +224,16 @@ jobs:
222224
- name: Save previous data.js
223225
run: |
224226
cp ./dist/other-repo/dev/bench/data.js before_data.js
225-
226227
- name: Store benchmark result
227228
uses: ./
228229
with:
229-
name: Catch2 Benchmark
230-
tool: 'catch2'
231-
output-file-path: examples/catch2/benchmark_result.txt
230+
name: JMH Benchmark
231+
tool: "jmh"
232+
output-file-path: examples/java/jmh-result.json
232233
fail-on-alert: true
233234
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
234235
github-token: ${{ secrets.GITHUB_TOKEN }}
235-
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Catch2 Benchmark' './benchmark-data-repository'
236+
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'JMH Benchmark' './benchmark-data-repository'
236237

237238
julia-benchmark:
238239
name: Run Julia benchmark example - github.com/benchmark-action/github-action-benchmark-results
@@ -277,22 +278,60 @@ jobs:
277278
github-token: ${{ secrets.GITHUB_TOKEN }}
278279
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Julia benchmark' './benchmark-data-repository'
279280

280-
benchmarkdotnet-framework:
281-
name: Run Benchmark.Net .Net Benchmark Framework example - github.com/benchmark-action/github-action-benchmark-results
281+
pytest-benchmark:
282+
name: Run Pytest benchmark example - github.com/benchmark-action/github-action-benchmark-results
282283
runs-on: ubuntu-latest
283284
steps:
284285
- uses: actions/checkout@v4
285-
- uses: actions/setup-dotnet@v3
286+
- uses: actions/setup-node@v4
286287
with:
287-
dotnet-version: '6.0.101' # SDK Version to use. keep in line with examples/benchmarkdotnet/global.json
288+
node-version: 20
289+
cache: 'npm'
290+
- uses: actions/setup-python@v5
291+
with:
292+
python-version: 3.9
293+
- run: npm ci
294+
- run: npm run build
295+
- name: Run benchmark
296+
run: |
297+
cd examples/pytest
298+
pip install -r requirements.txt
299+
pytest bench.py --benchmark-json output.json
300+
301+
- uses: actions/checkout@v4
302+
with:
303+
repository: benchmark-action/github-action-benchmark-results
304+
ref: 'gh-pages'
305+
path: 'dist/other-repo'
306+
- name: Save previous data.js
307+
run: |
308+
cp ./dist/other-repo/dev/bench/data.js before_data.js
309+
310+
- name: Store benchmark result
311+
uses: ./
312+
with:
313+
name: Python Benchmark with pytest-benchmark
314+
tool: 'pytest'
315+
output-file-path: examples/pytest/output.json
316+
fail-on-alert: true
317+
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
318+
github-token: ${{ secrets.GITHUB_TOKEN }}
319+
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Python Benchmark with pytest-benchmark' './benchmark-data-repository'
320+
321+
rust:
322+
name: Run Rust benchmark example - github.com/benchmark-action/github-action-benchmark-results
323+
runs-on: ubuntu-latest
324+
steps:
325+
- uses: actions/checkout@v4
288326
- uses: actions/setup-node@v4
289327
with:
290328
node-version: 20
291329
cache: 'npm'
292330
- run: npm ci
293331
- run: npm run build
332+
- run: rustup toolchain update nightly && rustup default nightly
294333
- name: Run benchmark
295-
run: cd examples/benchmarkdotnet && dotnet run --exporters json --filter '*'
334+
run: cd examples/rust && cargo +nightly bench | tee output.txt
296335

297336
- uses: actions/checkout@v4
298337
with:
@@ -306,13 +345,48 @@ jobs:
306345
- name: Store benchmark result
307346
uses: ./
308347
with:
309-
name: Benchmark.Net Benchmark
310-
tool: 'benchmarkdotnet'
311-
output-file-path: examples/benchmarkdotnet/BenchmarkDotNet.Artifacts/results/Sample.Benchmarks-report-full-compressed.json
348+
name: Rust Benchmark
349+
tool: 'cargo'
350+
output-file-path: examples/rust/output.txt
312351
fail-on-alert: true
313352
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
314353
github-token: ${{ secrets.GITHUB_TOKEN }}
315-
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Benchmark.Net Benchmark' './benchmark-data-repository'
354+
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Rust Benchmark' './benchmark-data-repository'
355+
356+
rust-criterion-rs-framework:
357+
name: Run Criterion.rs benchmark example - github.com/benchmark-action/github-action-benchmark-results
358+
runs-on: ubuntu-latest
359+
steps:
360+
- uses: actions/checkout@v4
361+
- uses: actions/setup-node@v4
362+
with:
363+
node-version: 20
364+
cache: 'npm'
365+
- run: npm ci
366+
- run: npm run build
367+
- run: rustup toolchain update nightly && rustup default nightly
368+
- name: Run benchmark
369+
run: cd examples/criterion-rs && cargo +nightly bench -- --output-format bencher | tee output.txt
370+
371+
- uses: actions/checkout@v4
372+
with:
373+
repository: benchmark-action/github-action-benchmark-results
374+
ref: 'gh-pages'
375+
path: 'dist/other-repo'
376+
- name: Save previous data.js
377+
run: |
378+
cp ./dist/other-repo/dev/bench/data.js before_data.js
379+
380+
- name: Store benchmark result
381+
uses: benchmark-action/github-action-benchmark@v1
382+
with:
383+
name: Criterion.rs Benchmark
384+
tool: 'cargo'
385+
output-file-path: examples/criterion-rs/output.txt
386+
fail-on-alert: true
387+
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
388+
github-token: ${{ secrets.GITHUB_TOKEN }}
389+
- run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Criterion.rs Benchmark' './benchmark-data-repository'
316390

317391
only-alert-with-cache:
318392
name: Run alert check with actions/cache

0 commit comments

Comments
 (0)