Skip to content

Commit

Permalink
move benchmark to camino-examples, update criterion, simplify CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshowers committed Aug 15, 2024
1 parent 92d69ed commit 205060a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,21 @@ jobs:
echo CARGO_REGISTRIES_CRATES_IO_PROTOCOL=git >> $GITHUB_ENV
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Install cargo-rm
run: cargo install cargo-edit --version 0.11.0
- name: Use pinned Cargo.lock for Rust 1.34 and 1.44
if: ${{ matrix.rust-version == 1.34 || matrix.rust-version == 1.44 }}
run: cp Cargo.lock.rust134 Cargo.lock
- name: Build the library
run: cargo build
# Remove criterion to support testing with earlier versions
- name: Remove criterion
run: cargo-rm rm --dev criterion
- name: Test
run: cargo test
- name: Build all targets with all features
# Some optional features are not compatible with earlier versions
if: ${{ matrix.rust-version == 'stable' }}
run: cargo hack --feature-powerset build --workspace
run: cargo hack --feature-powerset build --workspace --all-targets
- name: Test all targets with all features
# Some optional features are not compatible with earlier versions
if: ${{ matrix.rust-version == 'stable' }}
run: cargo hack --feature-powerset test --workspace
run: cargo hack --feature-powerset test --workspace --all-targets

miri:
name: Check unsafe code against miri
Expand Down
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ authors = [
edition = "2018"
exclude = [".cargo/**/*", ".github/**/*"]

[[bench]]
name = "bench"
harness = false

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg=doc_cfg"]
Expand All @@ -36,7 +32,6 @@ serde = { version = "1", features = ["derive"], optional = true }
[dev-dependencies]
bincode = "1"
serde_bytes = "0.11.8"
criterion = "0.4"

[features]
serde1 = ["serde"]
Expand Down
7 changes: 7 additions & 0 deletions camino-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@ clap = { version = "3.0.7", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1.0.62" }

[dev-dependencies]
criterion = "0.5.1"

[[bin]]
name = "serde"

[[bench]]
name = "bench"
harness = false
7 changes: 6 additions & 1 deletion benches/bench.rs → camino-examples/benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
use criterion::*;
// Copyright (c) The camino Contributors
// SPDX-License-Identifier: MIT OR Apache-2.0

// This benchmark is here because criterion has a higher MSRV than camino -- camino-examples is only
// tested on stable, which is good enough.

use camino::Utf8PathBuf;
use criterion::*;

fn bench_path(c: &mut Criterion) {
let mut group = c.benchmark_group("Path");
Expand Down

0 comments on commit 205060a

Please sign in to comment.