Skip to content

Commit

Permalink
feat: add improvements to speed up CI builds (#145)
Browse files Browse the repository at this point in the history
* feat: add hakari for speeding up builds
* feat: add concurrency to CI
* feat: add `format` dependency on long-running jobs
* feat: add cargo-nextest for CI

Co-authored-by: Boyuan Feng <bfeng9@wisc.edu>
  • Loading branch information
bhgomes and Boyuan Feng authored Jul 1, 2022
1 parent c83256a commit c4dd24b
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .config/hakari.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dep-format-version = "2"
exact-versions = true
hakari-package = "manta-workspace-hack"
platforms = []
resolver = "2"
46 changes: 32 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -43,26 +56,21 @@ 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
- run: rustup update nightly && rustup default nightly
- 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:
Expand All @@ -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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ members = [
"manta-parameters",
"manta-pay",
"manta-util",
"manta-workspace-hack",
]
1 change: 1 addition & 0 deletions manta-accounting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
1 change: 1 addition & 0 deletions manta-benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
1 change: 1 addition & 0 deletions manta-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions manta-parameters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
5 changes: 3 additions & 2 deletions manta-pay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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"] }
Expand Down
1 change: 1 addition & 0 deletions manta-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
4 changes: 4 additions & 0 deletions manta-workspace-hack/.gitattributes
Original file line number Diff line number Diff line change
@@ -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
66 changes: 66 additions & 0 deletions manta-workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions manta-workspace-hack/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// A build script is required for cargo to consider build dependencies.
fn main() {}
1 change: 1 addition & 0 deletions manta-workspace-hack/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This is a stub lib.rs.

0 comments on commit c4dd24b

Please sign in to comment.