Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add a rust workspace #868

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
- name: Check formatting
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets --all-features --workspace -- -D warnings
- name: Build docs
run: cargo doc --no-deps --all-features
run: cargo doc --no-deps --all-features --workspace
env:
RUSTDOCFLAGS: "-Dwarnings"

Expand All @@ -48,9 +48,9 @@ jobs:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build benchmarks with no features
run: cargo bench --verbose --no-run --no-default-features
run: cargo bench --verbose --no-run --workspace --no-default-features
- name: Build benchmarks with all features
run: cargo bench --verbose --no-run --all-features
run: cargo bench --verbose --no-run --workspace --all-features

tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -79,13 +79,13 @@ jobs:
- name: Configure default rust toolchain
run: rustup override set ${{steps.toolchain.outputs.name}}
- name: Build with no features
run: cargo test --verbose --no-default-features --no-run
run: cargo test --verbose --workspace --no-default-features --no-run
- name: Tests with no features
run: cargo test --verbose --no-default-features
run: cargo test --verbose --workspace --no-default-features
- name: Build with all features
run: cargo test --verbose --all-features --no-run
run: cargo test --verbose --workspace --all-features --no-run
- name: Tests with all features
run: cargo test --verbose --all-features
run: cargo test --verbose --workspace --all-features

coverage:
if: github.event_name != 'merge_group'
Expand All @@ -102,8 +102,8 @@ jobs:
- name: Run tests with coverage instrumentation
run: |
cargo llvm-cov clean --workspace
cargo llvm-cov --no-report --no-default-features --doctests
cargo llvm-cov --no-report --all-features --doctests
cargo llvm-cov --no-report --workspace --no-default-features --doctests
cargo llvm-cov --no-report --workspace --all-features --doctests
- name: Generate coverage report
run: cargo llvm-cov --all-features report --codecov --output-path coverage.json
- name: Upload coverage to codecov.io
Expand Down
81 changes: 18 additions & 63 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,70 +1,25 @@
[package]
name = "quantinuum-hugr"
version = "0.2.0"
edition = "2021"
rust-version = "1.75"

license = "Apache-2.0"
readme = "README.md"
documentation = "https://docs.rs/hugr/"
repository = "https://github.com/CQCL/hugr"
description = "Quantinuum's Hierarchical Unified Graph Representation"
keywords = ["Quantum", "Quantinuum"]
categories = ["compilers"]

[lib]
# Using different names for the lib and for the package is supported, but may be confusing.
# https://github.com/rust-lang/cargo/issues/6827
# TODO: Should we rename one of them?
name = "hugr"
bench = false
path = "src/lib.rs"
[profile.release]
lto = "thin"

[features]
extension_inference = []
[workspace]
resolver = "2"
members = ["quantinuum-hugr"]
default-members = ["quantinuum-hugr"]

[dependencies]
thiserror = "1.0.28"
portgraph = { version = "0.12.0", features = ["serde", "petgraph"] }
regex = "1.9.5"
cgmath = { version = "0.18.0", features = ["serde"] }
num-rational = { version = "0.4.1", features = ["serde"] }
downcast-rs = "1.2.0"
serde = { version = "1.0", features = [
# Rc used here for Extension, but unfortunately we must turn the feature on globally
"derive",
"rc",
] }
serde_yaml = "0.9.19"
typetag = "0.2.7"
smol_str = { version = "0.2.0", features = ["serde"] }
derive_more = "0.99.17"
itertools = "0.12.0"
html-escape = "0.2.13"
bitvec = { version = "1.0.1", features = ["serde"] }
enum_dispatch = "0.3.11"
lazy_static = "1.4.0"
petgraph = { version = "0.6.3", default-features = false }
context-iterators = "0.2.0"
serde_json = "1.0.97"
delegate = "0.12.0"
paste = "1.0"
strum = "0.26.1"
strum_macros = "0.26.1"

[dev-dependencies]
criterion = { version = "0.5.1", features = ["html_reports"] }
rstest = "0.18.1"
webbrowser = "0.8.10"
urlencoding = "2.1.2"
cool_asserts = "2.0.3"
insta = { version = "1.34.0", features = ["yaml"] }
jsonschema = "0.17.1"
[workspace.package]
rust-version = "1.75"
edition = "2021"
homepage = "https://github.com/CQCL/tket2"
repository = "https://github.com/CQCL/tket2"
license = "Apache-2.0"
# authors

[[bench]]
name = "bench_main"
harness = false
[workspace.lints.rust]
missing_docs = "warn"

[workspace.dependencies]
portgraph = { version = "0.12.0" }
insta = { version = "1.34.0" }

[profile.dev.package.insta]
opt-level = 3
64 changes: 64 additions & 0 deletions quantinuum-hugr/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[package]
name = "quantinuum-hugr"
version = "0.2.0"
edition = { workspace = true }
rust-version = { workspace = true }

license = { workspace = true }
readme = "README.md"
documentation = "https://docs.rs/hugr/"
homepage = { workspace = true }
repository = { workspace = true }
description = "Quantinuum's Hierarchical Unified Graph Representation"
keywords = ["Quantum", "Quantinuum"]
categories = ["compilers"]

[lib]
name = "hugr"
bench = false
path = "src/lib.rs"

[features]
extension_inference = []

[dependencies]
portgraph = { workspace = true, features = ["serde", "petgraph"] }
thiserror = "1.0.28"
regex = "1.9.5"
cgmath = { version = "0.18.0", features = ["serde"] }
num-rational = { version = "0.4.1", features = ["serde"] }
downcast-rs = "1.2.0"
serde = { version = "1.0", features = [
# Rc used here for Extension, but unfortunately we must turn the feature on globally
"derive",
"rc",
] }
serde_yaml = "0.9.19"
typetag = "0.2.7"
smol_str = { version = "0.2.0", features = ["serde"] }
derive_more = "0.99.17"
itertools = "0.12.0"
html-escape = "0.2.13"
bitvec = { version = "1.0.1", features = ["serde"] }
enum_dispatch = "0.3.11"
lazy_static = "1.4.0"
petgraph = { version = "0.6.3", default-features = false }
context-iterators = "0.2.0"
serde_json = "1.0.97"
delegate = "0.12.0"
paste = "1.0"
strum = "0.26.1"
strum_macros = "0.26.1"

[dev-dependencies]
criterion = { version = "0.5.1", features = ["html_reports"] }
rstest = "0.18.1"
webbrowser = "0.8.10"
urlencoding = "2.1.2"
cool_asserts = "2.0.3"
insta = { workspace = true, features = ["yaml"] }
jsonschema = "0.17.1"

[[bench]]
name = "bench_main"
harness = false
1 change: 1 addition & 0 deletions quantinuum-hugr/README.md
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ pub mod test {
lazy_static! {
static ref SCHEMA: JSONSchema = {
let schema_val: serde_json::Value = serde_json::from_str(include_str!(
"../../specification/schema/hugr_schema_v0.json"
"../../../specification/schema/hugr_schema_v0.json"
))
.unwrap();
JSONSchema::options()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/lib.rs → quantinuum-hugr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
//! ```
//!
#![warn(missing_docs)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this changing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it's on the workspace Cargo.toml (under [workspace.lints.rust]).

// Unstable check, may cause false positives.
// https://github.com/rust-lang/rust-clippy/issues/5112
#![warn(clippy::debug_assert_with_mut_call)]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
[workspace]
changelog_config = "cliff.toml" # use a custom git-cliff configuration
# disable the changelog for all packages
changelog_update = false

[[package]]
name = "quantinuum-hugr"
# enable the changelog for this package
changelog_update = true
# set the path of the changelog to the root of the repository
changelog_path = "./CHANGELOG.md"