diff --git a/.config/hakari.toml b/.config/hakari.toml new file mode 100644 index 000000000..aaa94a5dc --- /dev/null +++ b/.config/hakari.toml @@ -0,0 +1,5 @@ +dep-format-version = "2" +exact-versions = true +hakari-package = "manta-workspace-hack" +platforms = [] +resolver = "2" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c7fe0978..f228e2ad7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,13 +6,24 @@ on: - 'main' schedule: - cron: '0 0 * * */2' +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true env: CARGO_TERM_COLOR: always RUSTFLAGS: -D warnings -A unknown-lints RUST_BACKTRACE: full jobs: + format: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update nightly && rustup default nightly && rustup component add rustfmt + - run: cargo fmt --all -- --check test: name: Test (${{ matrix.os }} + ${{ matrix.channel }}) + needs: format strategy: fail-fast: false matrix: @@ -26,10 +37,12 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - run: rustup update ${{ matrix.channel }} --no-self-update && rustup default ${{ matrix.channel }} - - run: cargo test --all-features --workspace --release + - run: rustup update ${{ matrix.channel }} && rustup default ${{ matrix.channel }} + - run: cargo install cargo-nextest + - run: cargo nextest run --workspace --release --all-features lint: name: Lint (${{ matrix.os }} + ${{ matrix.channel }}) + needs: format strategy: fail-fast: false matrix: @@ -43,19 +56,13 @@ jobs: - uses: actions/checkout@v3 - run: rustup update ${{ matrix.channel }} && rustup default ${{ matrix.channel }} && rustup component add clippy - run: cargo install cargo-hack - - run: cargo hack clippy --feature-powerset --workspace - - run: cargo hack clippy --feature-powerset --workspace --bins - - run: cargo hack clippy --feature-powerset --workspace --examples - - run: cargo hack clippy --feature-powerset --workspace --tests - format: - name: Format - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: rustup update nightly && rustup default nightly && rustup component add rustfmt - - run: cargo fmt --all -- --check + - run: cargo hack clippy --workspace --feature-powerset + - run: cargo hack clippy --workspace --feature-powerset --bins + - run: cargo hack clippy --workspace --feature-powerset --examples + - run: cargo hack clippy --workspace --feature-powerset --tests docs: name: Docs + needs: format runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -63,6 +70,7 @@ jobs: - run: RUSTDOCFLAGS="-D warnings --cfg doc_cfg" cargo +nightly doc --workspace --all-features --no-deps --document-private-items compile-bench: name: Compile Bench (${{ matrix.os }} + ${{ matrix.channel }}) + needs: format strategy: fail-fast: false matrix: @@ -77,4 +85,14 @@ jobs: steps: - uses: actions/checkout@v3 - run: rustup update ${{ matrix.channel }} && rustup default ${{ matrix.channel }} - - run: cargo bench --no-run --workspace --all-features + - run: cargo bench --workspace --no-run --all-features + workspace-hack-check: + name: Workspace Hack Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update nightly && rustup default nightly + - run: cargo install cargo-hakari + - run: cargo hakari verify + - run: cargo hakari generate --diff + - run: cargo hakari manage-deps --dry-run diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fc749ecf..bf1da7d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] ### Added - [\#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 ### Changed diff --git a/Cargo.toml b/Cargo.toml index 218983c2c..845348c88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,4 +7,5 @@ members = [ "manta-parameters", "manta-pay", "manta-util", + "manta-workspace-hack", ] diff --git a/manta-accounting/Cargo.toml b/manta-accounting/Cargo.toml index 5b32e39c2..aa5105198 100644 --- a/manta-accounting/Cargo.toml +++ b/manta-accounting/Cargo.toml @@ -64,6 +64,7 @@ manta-util = { path = "../manta-util", default-features = false, features = ["al 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 } +manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } [dev-dependencies] manta-crypto = { path = "../manta-crypto", default-features = false, features = ["getrandom"] } diff --git a/manta-benchmark/Cargo.toml b/manta-benchmark/Cargo.toml index 2d57c280c..9457a188a 100644 --- a/manta-benchmark/Cargo.toml +++ b/manta-benchmark/Cargo.toml @@ -48,6 +48,7 @@ manta-pay = { path = "../manta-pay", default-features = false, features = ["grot 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"] } +manta-workspace-hack = { version = "0.1.0", path = "../manta-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 72c55e079..0e173d15d 100644 --- a/manta-crypto/Cargo.toml +++ b/manta-crypto/Cargo.toml @@ -42,6 +42,7 @@ derivative = { version = "2.2.0", default-features = false, features = ["use_cor manta-util = { path = "../manta-util", default-features = false, features = ["alloc"] } rand = { version = "0.8.4", optional = true, default-features = false, features = ["alloc"] } rand_core = { version = "0.6.3", default-features = false } +manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } [dev-dependencies] rand = "0.8.4" diff --git a/manta-parameters/Cargo.toml b/manta-parameters/Cargo.toml index 18a1d2b94..3b0f53ea8 100644 --- a/manta-parameters/Cargo.toml +++ b/manta-parameters/Cargo.toml @@ -35,6 +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" } [dev-dependencies] git2 = { version = "0.14.4", default-features = false } diff --git a/manta-pay/Cargo.toml b/manta-pay/Cargo.toml index 1fdf887cb..76efff574 100644 --- a/manta-pay/Cargo.toml +++ b/manta-pay/Cargo.toml @@ -117,7 +117,7 @@ ark-std = { version = "0.3.0", optional = true, default-features = false } bip32 = { version = "0.3.0", optional = true, default-features = false, features = ["bip39", "secp256k1"] } blake2 = { version = "0.10.4", default-features = false } bs58 = { version = "0.4.0", optional = true, default-features = false, features = ["alloc"] } -clap = { version = "3.2.6", optional = true, default-features = false, features = ["color", "derive", "std", "suggestions", "unicode", "wrap_help"] } +clap = { version = "3.2.8", optional = true, default-features = false, features = ["color", "derive", "std", "suggestions", "unicode", "wrap_help"] } derivative = { version = "2.2.0", default-features = false, features = ["use_core"] } futures = { version = "0.3.21", optional = true, default-features = false } indexmap = { version = "1.8.2", optional = true, default-features = false } @@ -131,12 +131,13 @@ rayon = { version = "1.5.1", optional = true, default-features = false } reqwest = { version = "0.11.9", optional = true, default-features = false, features = ["json"] } scale-codec = { package = "parity-scale-codec", version = "3.1.2", optional = true, default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.2", optional = true, default-features = false, features = ["derive"] } -serde_json = { version = "1.0.79", optional = true, default-features = false, features = ["alloc"] } +serde_json = { version = "1.0.82", optional = true, default-features = false, features = ["alloc"] } 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"] } ws_stream_wasm = { version = "0.7.3", optional = true, default-features = false } +manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } [dev-dependencies] manta-crypto = { path = "../manta-crypto", default-features = false, features = ["getrandom"] } diff --git a/manta-util/Cargo.toml b/manta-util/Cargo.toml index c507c70cb..b95150fc3 100644 --- a/manta-util/Cargo.toml +++ b/manta-util/Cargo.toml @@ -42,3 +42,4 @@ crossbeam-channel = { version = "0.5.4", optional = true, default-features = fal rayon = { version = "1.5.3", optional = true, default-features = false } serde = { version = "1.0.137", optional = true, default-features = false, features = ["derive"] } serde_with = { version = "1.14.0", optional = true, default-features = false, features = ["macros"] } +manta-workspace-hack = { version = "0.1.0", path = "../manta-workspace-hack" } diff --git a/manta-workspace-hack/.gitattributes b/manta-workspace-hack/.gitattributes new file mode 100644 index 000000000..3e9dba4b6 --- /dev/null +++ b/manta-workspace-hack/.gitattributes @@ -0,0 +1,4 @@ +# Avoid putting conflict markers in the generated Cargo.toml file, since their presence breaks +# Cargo. +# Also do not check out the file as CRLF on Windows, as that's what hakari needs. +Cargo.toml merge=binary -crlf diff --git a/manta-workspace-hack/Cargo.toml b/manta-workspace-hack/Cargo.toml new file mode 100644 index 000000000..f195722d6 --- /dev/null +++ b/manta-workspace-hack/Cargo.toml @@ -0,0 +1,66 @@ +# This file is generated by `cargo hakari`. +# To regenerate, run: +# cargo hakari generate + +[package] +name = "manta-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. +publish = false + +# The parts of the file between the BEGIN HAKARI SECTION and END HAKARI SECTION comments +# are managed by hakari. + +### BEGIN HAKARI SECTION +[dependencies] +aes-gcm = { version = "0.9.4", features = ["aes", "alloc"] } +anyhow = { version = "1.0.58", features = ["std"] } +bitflags = { version = "1.3.2" } +blake3 = { version = "1.3.1", default-features = false, features = ["digest", "std"] } +block-buffer = { version = "0.9.0", default-features = false, features = ["block-padding"] } +crypto-common = { version = "0.1.3", default-features = false, features = ["std"] } +digest-93f6ce9d446188ac = { package = "digest", version = "0.10.3", features = ["alloc", "block-buffer", "core-api", "mac", "std", "subtle"] } +digest-274715c4dabd11b0 = { package = "digest", version = "0.9.0", default-features = false, features = ["alloc", "std"] } +futures = { version = "0.3.21", features = ["alloc", "async-await", "executor", "futures-executor", "std"] } +futures-channel = { version = "0.3.21", default-features = false, features = ["alloc", "futures-sink", "sink", "std"] } +futures-core = { version = "0.3.21", features = ["alloc", "std"] } +futures-io = { version = "0.3.21", features = ["std"] } +futures-sink = { version = "0.3.21", default-features = false, features = ["alloc", "std"] } +futures-task = { version = "0.3.21", default-features = false, features = ["alloc", "std"] } +futures-util = { version = "0.3.21", features = ["alloc", "async-await", "async-await-macro", "channel", "futures-channel", "futures-io", "futures-macro", "futures-sink", "io", "memchr", "sink", "slab", "std"] } +generic-array = { version = "0.14.5", default-features = false, features = ["more_lengths"] } +getrandom = { version = "0.2.7", default-features = false, features = ["js", "js-sys", "std", "wasm-bindgen"] } +indexmap = { version = "1.9.1", default-features = false, features = ["std"] } +log = { version = "0.4.17", default-features = false, features = ["kv_unstable", "kv_unstable_std", "std", "value-bag"] } +memchr = { version = "2.5.0", features = ["std"] } +num-traits = { version = "0.2.15", features = ["i128", "libm", "std"] } +pbkdf2 = { version = "0.9.0", default-features = false, features = ["hmac", "sha2"] } +ppv-lite86 = { version = "0.2.16", default-features = false, features = ["simd", "std"] } +rand = { version = "0.8.5", features = ["alloc", "getrandom", "libc", "rand_chacha", "std", "std_rng"] } +rand_chacha = { version = "0.3.1", default-features = false, features = ["std"] } +rand_core = { version = "0.6.3", default-features = false, features = ["alloc", "getrandom", "std"] } +serde = { version = "1.0.137", features = ["alloc", "derive", "serde_derive", "std"] } +serde_json = { version = "1.0.82", features = ["alloc", "std"] } +sha2 = { version = "0.9.9", features = ["std"] } +standback = { version = "0.2.17", default-features = false, features = ["std"] } +subtle = { version = "2.4.1", default-features = false, features = ["i128"] } +url = { version = "2.2.2", default-features = false, features = ["serde"] } +web-sys = { version = "0.3.58", default-features = false, features = ["BinaryType", "Blob", "CloseEvent", "DomException", "Event", "EventTarget", "MessageEvent", "WebSocket", "console"] } +zeroize = { version = "1.4.3", default-features = false, features = ["alloc", "zeroize_derive"] } + +[build-dependencies] +anyhow = { version = "1.0.58", features = ["std"] } +blake3 = { version = "1.3.1", default-features = false, features = ["digest", "std"] } +cc = { version = "1.0.73", default-features = false, features = ["jobserver", "parallel"] } +crypto-common = { version = "0.1.3", default-features = false, features = ["std"] } +digest-93f6ce9d446188ac = { package = "digest", version = "0.10.3", features = ["alloc", "block-buffer", "core-api", "mac", "std", "subtle"] } +generic-array = { version = "0.14.5", default-features = false, features = ["more_lengths"] } +log = { version = "0.4.17", default-features = false, features = ["kv_unstable", "kv_unstable_std", "std", "value-bag"] } +num-traits = { version = "0.2.15", features = ["i128", "libm", "std"] } +serde = { version = "1.0.137", features = ["alloc", "derive", "serde_derive", "std"] } +standback = { version = "0.2.17", default-features = false, features = ["std"] } +subtle = { version = "2.4.1", default-features = false, features = ["i128"] } +syn = { version = "1.0.98", features = ["clone-impls", "derive", "extra-traits", "fold", "full", "parsing", "printing", "proc-macro", "quote", "visit", "visit-mut"] } + +### END HAKARI SECTION diff --git a/manta-workspace-hack/build.rs b/manta-workspace-hack/build.rs new file mode 100644 index 000000000..92518ef04 --- /dev/null +++ b/manta-workspace-hack/build.rs @@ -0,0 +1,2 @@ +// A build script is required for cargo to consider build dependencies. +fn main() {} diff --git a/manta-workspace-hack/src/lib.rs b/manta-workspace-hack/src/lib.rs new file mode 100644 index 000000000..22489f632 --- /dev/null +++ b/manta-workspace-hack/src/lib.rs @@ -0,0 +1 @@ +// This is a stub lib.rs.