Skip to content

Commit

Permalink
meta: convert repo to workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill committed Aug 14, 2024
1 parent 59793e1 commit 0d618cd
Show file tree
Hide file tree
Showing 44 changed files with 116 additions and 96 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,22 @@ jobs:
cargo --version
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-nextest

- name: feature compatibility
run: cargo hack check --feature-powerset --no-dev-deps
run: make check-features

- name: rustfmt
run: cargo fmt -- --check

- name: clippy
run: cargo clippy --all-features --all-targets

- name: rustdoc
env:
RUSTDOCFLAGS: "--cfg=doc_cfg -Zunstable-options --generate-link-to-definition"
RUSTC_BOOTSTRAP: 1
run: cargo doc --all-features --no-deps
run: make clippy

- name: Run tests
run: cargo test --all-features
run: make test

- name: rustdoc
run: make doc

wasm:
runs-on: ubuntu-latest
Expand All @@ -63,6 +61,4 @@ jobs:
run: sudo apt-get install -y clang

- name: Run tests in wasm
env:
CC: clang
run: wasm-pack test --node --all-features
run: make wasm
5 changes: 1 addition & 4 deletions .github/workflows/rustdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ jobs:
uses: actions/checkout@v4

- name: rustdoc
env:
RUSTDOCFLAGS: "--cfg=doc_cfg -Zunstable-options --generate-link-to-definition"
RUSTC_BOOTSTRAP: 1
run: cargo doc --all-features --no-deps
run: make doc

- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
Expand Down
74 changes: 3 additions & 71 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,71 +1,3 @@
[package]
name = "sui-sdk"
version = "0.0.0"
authors = ["Brandon Williams <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
publish = false
readme = "README.md"
description = "Sdk for the Sui Blockchain"

[package.metadata.docs.rs]
# To build locally:
# RUSTDOCFLAGS="--cfg=doc_cfg -Zunstable-options --generate-link-to-definition" RUSTC_BOOTSTRAP=1 cargo doc --all-features --no-deps --open
all-features = true
rustdoc-args = [
# Enable doc_cfg showing the required features.
"--cfg=doc_cfg",

# Generate links to definition in rustdoc source code pages
# https://github.com/rust-lang/rust/pull/84176
"-Zunstable-options", "--generate-link-to-definition"
]

[features]
default = []
serde = ["dep:serde", "dep:serde_derive", "dep:serde_with", "dep:bcs", "dep:serde_json", "roaring/std"]
schemars = ["serde", "dep:schemars", "dep:serde_json"]
rand = ["dep:rand_core"]
hash = ["dep:blake2"]

[dependencies]
base64ct = { version = "1.6.0", features = ["alloc"] }
bs58 = "0.5.1"
hex = "0.4.3"
roaring = { version = "0.10.6", default-features = false }
bnum = "0.11.0"
winnow = "0.6.18"

# Serialization and Deserialization support
serde = { version = "1.0.190", optional = true }
serde_derive = { version = "1.0.190", optional = true }
serde_with = { version = "3.9", default-features = false, features = ["alloc"], optional = true }
bcs = { version = "0.1.6", optional = true }
serde_json = { version = "1.0.114", optional = true }

# JsonSchema definitions for types, useful for generating an OpenAPI Specificaiton.
schemars = { version = "0.8.21", optional = true }

# RNG support
rand_core = { version = "0.6.4", optional = true }

# Hash support
blake2 = { version = "0.10.6", optional = true }

[dev-dependencies]
bcs = "0.1.6"
serde_json = "1.0.114"
num-bigint = "0.4.4"
jsonschema = { version = "0.18", default-features = false }
paste = "1.0.15"

# proptest support in tests
#
# Pin to this specific commit in order to work around an issue where proptest doesn't build properly in wasm environments
# see https://github.com/proptest-rs/proptest/pull/270 for more info
proptest = { git = "https://github.com/bmwill/proptest.git", rev = "bc36db126183bce18c8bc595f0c0cfeac48b870c", default-features = false, features = ["std"] }
test-strategy = "0.3.1"

[target.wasm32-unknown-unknown.dev-dependencies]
wasm-bindgen-test = "0.3"
getrandom = { version = "0.2", features = ["js"] }
[workspace]
resolver = "2"
members = ["crates/*"]
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Set the default target of this Makefile
.PHONY: all
all:: ci-full
all:: ci

.PHONY: check
check:
cargo hack check --feature-powerset --no-dev-deps
.PHONY: check-features
check-features:
$(MAKE) -C crates/sui-sdk check-features

.PHONY: fmt-check
fmt-check:
.PHONY: check-fmt
check-fmt:
cargo fmt -- --check

.PHONY: clippy
Expand All @@ -16,11 +16,12 @@ clippy:

.PHONY: test
test:
cargo test --all-features
cargo nextest run --all-features
cargo test --doc

.PHONY: wasm
wasm:
CC=clang wasm-pack test --node --all-features
$(MAKE) -C crates/sui-sdk wasm

.PHONY: doc
doc:
Expand All @@ -31,7 +32,7 @@ doc-open:
RUSTDOCFLAGS="--cfg=doc_cfg -Zunstable-options --generate-link-to-definition" RUSTC_BOOTSTRAP=1 cargo doc --all-features --no-deps --open

.PHONY: ci
ci: check fmt-check clippy test wasm
ci: check-features check-fmt test wasm

.PHONY: ci-full
ci-full: ci doc
Expand Down
71 changes: 71 additions & 0 deletions crates/sui-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[package]
name = "sui-sdk"
version = "0.0.0"
authors = ["Brandon Williams <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
publish = false
readme = "README.md"
description = "Sdk for the Sui Blockchain"

[package.metadata.docs.rs]
# To build locally:
# RUSTDOCFLAGS="--cfg=doc_cfg -Zunstable-options --generate-link-to-definition" RUSTC_BOOTSTRAP=1 cargo doc --all-features --no-deps --open
all-features = true
rustdoc-args = [
# Enable doc_cfg showing the required features.
"--cfg=doc_cfg",

# Generate links to definition in rustdoc source code pages
# https://github.com/rust-lang/rust/pull/84176
"-Zunstable-options", "--generate-link-to-definition"
]

[features]
default = []
serde = ["dep:serde", "dep:serde_derive", "dep:serde_with", "dep:bcs", "dep:serde_json", "roaring/std"]
schemars = ["serde", "dep:schemars", "dep:serde_json"]
rand = ["dep:rand_core"]
hash = ["dep:blake2"]

[dependencies]
base64ct = { version = "1.6.0", features = ["alloc"] }
bs58 = "0.5.1"
hex = "0.4.3"
roaring = { version = "0.10.6", default-features = false }
bnum = "0.11.0"
winnow = "0.6.18"

# Serialization and Deserialization support
serde = { version = "1.0.190", optional = true }
serde_derive = { version = "1.0.190", optional = true }
serde_with = { version = "3.9", default-features = false, features = ["alloc"], optional = true }
bcs = { version = "0.1.6", optional = true }
serde_json = { version = "1.0.114", optional = true }

# JsonSchema definitions for types, useful for generating an OpenAPI Specificaiton.
schemars = { version = "0.8.21", optional = true }

# RNG support
rand_core = { version = "0.6.4", optional = true }

# Hash support
blake2 = { version = "0.10.6", optional = true }

[dev-dependencies]
bcs = "0.1.6"
serde_json = "1.0.114"
num-bigint = "0.4.4"
jsonschema = { version = "0.18", default-features = false }
paste = "1.0.15"

# proptest support in tests
#
# Pin to this specific commit in order to work around an issue where proptest doesn't build properly in wasm environments
# see https://github.com/proptest-rs/proptest/pull/270 for more info
proptest = { git = "https://github.com/bmwill/proptest.git", rev = "bc36db126183bce18c8bc595f0c0cfeac48b870c", default-features = false, features = ["std"] }
test-strategy = "0.3.1"

[target.wasm32-unknown-unknown.dev-dependencies]
wasm-bindgen-test = "0.3"
getrandom = { version = "0.2", features = ["js"] }
23 changes: 23 additions & 0 deletions crates/sui-sdk/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Set the default target of this Makefile
.PHONY: all
all:: check-features clippy test wasm

.PHONY: check-features
check-features:
cargo hack check --feature-powerset --no-dev-deps

.PHONY: clippy
clippy:
cargo clippy --all-features --all-targets

.PHONY: test
test:
cargo nextest run --all-features
cargo test --doc

.PHONY: wasm
wasm:
CC=clang wasm-pack test --node --all-features

%:
$(MAKE) -C ../.. $@
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.
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.

0 comments on commit 0d618cd

Please sign in to comment.