From 449d63136c0db8fd9307e9e5837664cdb46fe948 Mon Sep 17 00:00:00 2001 From: "Brandon H. Gomes" Date: Thu, 7 Jul 2022 19:41:37 -0400 Subject: [PATCH] feat: add `cargo-sort` to the CI pipeline (#163) --- .config/hakari.toml | 2 +- .github/workflows/ci.yml | 21 +++++++++++++------ CHANGELOG.md | 1 + Cargo.toml | 2 +- manta-accounting/Cargo.toml | 2 +- manta-accounting/src/wallet/balance.rs | 2 -- manta-benchmark/Cargo.toml | 2 +- manta-crypto/Cargo.toml | 2 +- manta-crypto/src/merkle_tree/mod.rs | 3 --- manta-parameters/Cargo.toml | 2 +- manta-pay/Cargo.toml | 2 +- manta-util/Cargo.toml | 2 +- .../.gitattributes | 0 .../Cargo.toml | 2 +- .../build.rs | 0 .../src/lib.rs | 0 16 files changed, 25 insertions(+), 20 deletions(-) rename {manta-workspace-hack => workspace-hack}/.gitattributes (100%) rename {manta-workspace-hack => workspace-hack}/Cargo.toml (99%) rename {manta-workspace-hack => workspace-hack}/build.rs (100%) rename {manta-workspace-hack => workspace-hack}/src/lib.rs (100%) diff --git a/.config/hakari.toml b/.config/hakari.toml index aaa94a5dc..f340f3311 100644 --- a/.config/hakari.toml +++ b/.config/hakari.toml @@ -1,5 +1,5 @@ dep-format-version = "2" exact-versions = true -hakari-package = "manta-workspace-hack" +hakari-package = "workspace-hack" platforms = [] resolver = "2" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b11f12f0b..f4d73e885 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ concurrency: cancel-in-progress: true env: CARGO_TERM_COLOR: always - RUSTFLAGS: -D warnings -A unknown-lints + RUSTFLAGS: -D warnings RUST_BACKTRACE: full jobs: workspace-hack-check: @@ -31,8 +31,17 @@ jobs: - uses: actions/checkout@v3 - run: rustup update nightly && rustup default nightly && rustup component add rustfmt - run: cargo fmt --all -- --check + format-cargo-toml: + name: Format Crate Configuration Files + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update nightly && rustup default nightly + - run: cargo install cargo-sort + - run: cargo sort workspace-hack + - run: cargo sort --workspace --check docs: - name: Docs + name: Build Documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -40,7 +49,7 @@ jobs: - run: RUSTDOCFLAGS="-D warnings --cfg doc_cfg" cargo +nightly doc --workspace --all-features --no-deps --document-private-items lint: name: Lint (${{ matrix.os }} + ${{ matrix.channel }}) - needs: [workspace-hack-check, format, docs] + needs: [workspace-hack-check, format, format-cargo-toml, docs] strategy: fail-fast: false matrix: @@ -60,7 +69,7 @@ jobs: - run: cargo hack clippy --workspace --feature-powerset --tests test: name: Test (${{ matrix.os }} + ${{ matrix.channel }}) - needs: [workspace-hack-check, format, docs] + needs: [workspace-hack-check, format, format-cargo-toml, docs] strategy: fail-fast: false matrix: @@ -78,8 +87,8 @@ jobs: - run: cargo install cargo-nextest - run: cargo nextest run --workspace --release --all-features compile-bench: - name: Compile Bench (${{ matrix.os }} + ${{ matrix.channel }}) - needs: [workspace-hack-check, format, docs] + name: Compile Benchmarks (${{ matrix.os }} + ${{ matrix.channel }}) + needs: [workspace-hack-check, format, format-cargo-toml, docs] strategy: fail-fast: false matrix: diff --git a/CHANGELOG.md b/CHANGELOG.md index d1282d622..f3ad13287 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - [\#144](https://github.com/Manta-Network/manta-rs/pull/144) Add new release PR template for future releases - [\#145](https://github.com/Manta-Network/manta-rs/pull/145) Add `cargo-hakari` and `cargo-nextest` to speed up CI pipeline - [\#147](https://github.com/Manta-Network/manta-rs/pull/147) Add benchmarks for Arkworks elliptic curve operations +- [\#163](https://github.com/Manta-Network/manta-rs/pull/163) Add `cargo-sort` to the CI pipeline for formatting `Cargo.toml` files ### Changed - [\#152](https://github.com/Manta-Network/manta-rs/pull/152) Make `format` and `docs` as prerequisites for the rest of the CI pipeline diff --git a/Cargo.toml b/Cargo.toml index 87511e2a9..70582fc61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] resolver = "2" -members = ["manta-*"] +members = ["manta-*", "workspace-hack"] diff --git a/manta-accounting/Cargo.toml b/manta-accounting/Cargo.toml index 67b00210d..da4f2cb62 100644 --- a/manta-accounting/Cargo.toml +++ b/manta-accounting/Cargo.toml @@ -61,10 +61,10 @@ futures = { version = "0.3.21", optional = true, default-features = false, featu indexmap = { version = "1.8.0", optional = true, default-features = false } manta-crypto = { path = "../manta-crypto", default-features = false } manta-util = { path = "../manta-util", default-features = false, features = ["alloc"] } -manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } parking_lot = { version = "0.12.0", optional = true, default-features = false } rand_chacha = { version = "0.3.1", optional = true, default-features = false } statrs = { version = "0.15.0", optional = true, default-features = false } +workspace-hack = { version = "0.1.0", path = "../workspace-hack" } [dev-dependencies] manta-crypto = { path = "../manta-crypto", default-features = false, features = ["getrandom"] } diff --git a/manta-accounting/src/wallet/balance.rs b/manta-accounting/src/wallet/balance.rs index 62d30c88e..a72f4f9db 100644 --- a/manta-accounting/src/wallet/balance.rs +++ b/manta-accounting/src/wallet/balance.rs @@ -81,13 +81,11 @@ impl BalanceState for AssetList { self.value(id) } - #[allow(clippy::only_used_in_recursion)] // NOTE: False-positive: rust-clippy/issues/8560 #[inline] fn deposit(&mut self, asset: Asset) { self.deposit(asset); } - #[allow(clippy::only_used_in_recursion)] // NOTE: False-positive: rust-clippy/issues/8560 #[inline] fn withdraw(&mut self, asset: Asset) -> bool { self.withdraw(asset) diff --git a/manta-benchmark/Cargo.toml b/manta-benchmark/Cargo.toml index 40a970211..643f9af17 100644 --- a/manta-benchmark/Cargo.toml +++ b/manta-benchmark/Cargo.toml @@ -52,10 +52,10 @@ instant = { version = "0.1.12", default-features = false, features = [ "wasm-bin manta-accounting = { path = "../manta-accounting", default-features = false, features = ["test"] } manta-crypto = { path = "../manta-crypto", default-features = false, features = ["getrandom", "test"] } manta-pay = { path = "../manta-pay", default-features = false, features = ["groth16", "test"] } -manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } wasm-bindgen = { version = "0.2.81", default-features = false } wasm-bindgen-test = { version = "0.3.30", default-features = false } web-sys = { version = "0.3.58", default-features = false, features = ["console"] } +workspace-hack = { version = "0.1.0", path = "../workspace-hack" } [dev-dependencies] criterion = { version = "0.3.4", default-features = false } diff --git a/manta-crypto/Cargo.toml b/manta-crypto/Cargo.toml index d63635ed3..ca9b45782 100644 --- a/manta-crypto/Cargo.toml +++ b/manta-crypto/Cargo.toml @@ -40,9 +40,9 @@ test = [] [dependencies] derivative = { version = "2.2.0", default-features = false, features = ["use_core"] } manta-util = { path = "../manta-util", default-features = false, features = ["alloc"] } -manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } rand = { version = "0.8.4", optional = true, default-features = false, features = ["alloc"] } rand_core = { version = "0.6.3", default-features = false } +workspace-hack = { version = "0.1.0", path = "../workspace-hack" } [dev-dependencies] rand = "0.8.4" diff --git a/manta-crypto/src/merkle_tree/mod.rs b/manta-crypto/src/merkle_tree/mod.rs index cfa23ddea..7fadc165e 100644 --- a/manta-crypto/src/merkle_tree/mod.rs +++ b/manta-crypto/src/merkle_tree/mod.rs @@ -16,9 +16,6 @@ //! Merkle Trees and Forests -// NOTE: clippy false-positive: https://github.com/rust-lang/rust-clippy/pull/8869 -#![allow(clippy::derive_partial_eq_without_eq)] - // FIXME: Get rid of as many `pub(super)` declarations as we can. // TODO: Should `Leaf` move into `Tree`/`Configuration` since we might want the tree to have // special kinds of leaf input (metadata along with just the digest)? diff --git a/manta-parameters/Cargo.toml b/manta-parameters/Cargo.toml index 3b0f53ea8..0f261dbc8 100644 --- a/manta-parameters/Cargo.toml +++ b/manta-parameters/Cargo.toml @@ -35,7 +35,7 @@ std = ["anyhow?/std"] anyhow = { version = "1.0.57", optional = true, default-features = false } attohttpc = { version = "0.19.1", optional = true } blake3 = { version = "1.3.1", default-features = false } -manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } +workspace-hack = { version = "0.1.0", path = "../workspace-hack" } [dev-dependencies] git2 = { version = "0.14.4", default-features = false } diff --git a/manta-pay/Cargo.toml b/manta-pay/Cargo.toml index 77bbedd77..e4ae9b695 100644 --- a/manta-pay/Cargo.toml +++ b/manta-pay/Cargo.toml @@ -125,7 +125,6 @@ manta-accounting = { path = "../manta-accounting", default-features = false } manta-crypto = { path = "../manta-crypto", default-features = false } manta-parameters = { path = "../manta-parameters", optional = true, default-features = false } manta-util = { path = "../manta-util", default-features = false } -manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } parking_lot = { version = "0.12.1", optional = true, default-features = false } rand_chacha = { version = "0.3.1", default-features = false } rayon = { version = "1.5.1", optional = true, default-features = false } @@ -137,6 +136,7 @@ tempfile = { version = "3.3.0", optional = true, default-features = false } tide = { version = "0.16.0", optional = true, default-features = false, features = ["h1-server"] } tokio = { version = "1.18.2", optional = true, default-features = false } tokio-tungstenite = { version = "0.17.1", optional = true, default-features = false, features = ["native-tls"] } +workspace-hack = { version = "0.1.0", path = "../workspace-hack" } ws_stream_wasm = { version = "0.7.3", optional = true, default-features = false } [dev-dependencies] diff --git a/manta-util/Cargo.toml b/manta-util/Cargo.toml index 6e38136dc..b864f037d 100644 --- a/manta-util/Cargo.toml +++ b/manta-util/Cargo.toml @@ -39,7 +39,7 @@ std = ["alloc"] [dependencies] crossbeam-channel = { version = "0.5.4", optional = true, default-features = false } -manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } rayon = { version = "1.5.3", optional = true, default-features = false } serde = { version = "1.0.138", optional = true, default-features = false, features = ["derive"] } serde_with = { version = "1.14.0", optional = true, default-features = false, features = ["macros"] } +workspace-hack = { version = "0.1.0", path = "../workspace-hack" } diff --git a/manta-workspace-hack/.gitattributes b/workspace-hack/.gitattributes similarity index 100% rename from manta-workspace-hack/.gitattributes rename to workspace-hack/.gitattributes diff --git a/manta-workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml similarity index 99% rename from manta-workspace-hack/Cargo.toml rename to workspace-hack/Cargo.toml index 31d5830d8..403d9c31e 100644 --- a/manta-workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -3,7 +3,7 @@ # cargo hakari generate [package] -name = "manta-workspace-hack" +name = "workspace-hack" version = "0.1.0" description = "workspace-hack package, managed by hakari" # You can choose to publish this crate: see https://docs.rs/cargo-hakari/latest/cargo_hakari/publishing. diff --git a/manta-workspace-hack/build.rs b/workspace-hack/build.rs similarity index 100% rename from manta-workspace-hack/build.rs rename to workspace-hack/build.rs diff --git a/manta-workspace-hack/src/lib.rs b/workspace-hack/src/lib.rs similarity index 100% rename from manta-workspace-hack/src/lib.rs rename to workspace-hack/src/lib.rs