Skip to content

Commit 06a4476

Browse files
committed
ci: Disable a benchmark that panics on the CI
1 parent 06bf487 commit 06a4476

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.github/workflows/benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
bins: cargo-codspeed
2929

3030
- name: Build the benchmark target(s)
31-
run: cargo codspeed build -p benchmarks ${{ matrix.benchmark }}
31+
run: cargo codspeed build -p benchmarks ${{ matrix.benchmark }} --features codspeed
3232

3333
- name: Run the benchmarks
3434
uses: CodSpeedHQ/action@0b6e7a3d96c9d2a6057e7bcea6b45aaf2f7ce60b

benchmarks/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ publish = false
1010
[package.metadata.release]
1111
release = false
1212

13+
[features]
14+
codspeed = []
15+
1316
[dependencies]
1417
criterion = { version = "3.0.4", features = ["async", "async_tokio", "html_reports"], package = "codspeed-criterion-compat" }
1518
matrix-sdk = { workspace = true, features = ["native-tls", "e2e-encryption", "sqlite", "testing"] }

benchmarks/benches/crypto_bench.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{ops::Deref, sync::Arc};
22

3-
use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
3+
use criterion::{BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
44
use matrix_sdk_crypto::{EncryptionSettings, OlmMachine};
55
use matrix_sdk_sqlite::SqliteCryptoStore;
66
use matrix_sdk_test::ruma_response_from_json;
@@ -85,6 +85,8 @@ pub fn keys_query(c: &mut Criterion) {
8585
group.finish()
8686
}
8787

88+
/// This test panics on the CI, not sure why so we're disabling it for now.
89+
#[cfg(not(feature = "codspeed"))]
8890
pub fn keys_claiming(c: &mut Criterion) {
8991
let runtime = Builder::new_multi_thread().build().expect("Can't create runtime");
9092

@@ -115,7 +117,7 @@ pub fn keys_claiming(c: &mut Criterion) {
115117
drop(machine);
116118
})
117119
},
118-
BatchSize::SmallInput,
120+
criterion::BatchSize::SmallInput,
119121
)
120122
});
121123

@@ -289,9 +291,18 @@ fn criterion() -> Criterion {
289291
criterion
290292
}
291293

294+
#[cfg(not(feature = "codspeed"))]
292295
criterion_group! {
293296
name = benches;
294297
config = criterion();
295298
targets = keys_query, keys_claiming, room_key_sharing, devices_missing_sessions_collecting,
296299
}
300+
301+
#[cfg(feature = "codspeed")]
302+
criterion_group! {
303+
name = benches;
304+
config = criterion();
305+
targets = keys_query, room_key_sharing, devices_missing_sessions_collecting,
306+
}
307+
297308
criterion_main!(benches);

0 commit comments

Comments
 (0)