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

ref: new workspace structure and version management #280

Merged
merged 13 commits into from
Sep 20, 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
42 changes: 42 additions & 0 deletions .github/workflows/check-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: check-publish
# This workflow checks that the libraries can be published on crates.io.
permissions:
contents: read
on:
push:
branches: [ main ]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check-publish:
name: Check publish on crates.io
Copy link
Member

Choose a reason for hiding this comment

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

That looks cool!

Copy link
Member

Choose a reason for hiding this comment

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

But I would change the pr's name to ref: ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@qalisander how about ref: new workspace structure

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: set up rust
uses: dtolnay/rust-toolchain@master
id: toolchain
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
Copy link
Collaborator

Choose a reason for hiding this comment

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

We define the version of the toolchain in main places across workflows. I wonder if it would be better to specify it in rust-toolchain.toml file and then:

  • Actions can just use that version
  • Everyone that runs the project locally will use the same version of the toolchain

Copy link
Collaborator Author

Choose a reason for hiding this comment

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


- uses: Swatinem/rust-cache@v2

- name: check motsu-proc
run: cargo publish -p motsu-proc --dry-run

- name: check motsu
run: cargo publish -p motsu --dry-run

- name: check openzeppelin-crypto
run: cargo publish -p openzeppelin-crypto --target wasm32-unknown-unknown --dry-run

# TODO: https://github.com/OpenZeppelin/rust-contracts-stylus/issues/291
# - name: check openzeppelin-stylus
# run: cargo publish -p openzeppelin-stylus --target wasm32-unknown-unknown --dry-run
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ edition = "2021"
license = "MIT"
keywords = ["arbitrum", "ethereum", "stylus"]
repository = "https://github.com/OpenZeppelin/rust-contracts-stylus"
version = "0.1.0-rc"

[workspace.lints.rust]
missing_docs = "warn"
Expand Down Expand Up @@ -95,6 +96,14 @@ syn = { version = "2.0.58", features = ["full"] }
proc-macro2 = "1.0.79"
quote = "1.0.35"

# members
openzeppelin-stylus = { path = "contracts" }
openzeppelin-crypto = { path = "lib/crypto" }
motsu = { path = "lib/motsu"}
motsu-proc = { path = "lib/motsu-proc", version = "0.1.0" }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we set a specific version for motsu-proc? Is this intentional?

Copy link
Collaborator Author

@bidzyyys bidzyyys Sep 20, 2024

Choose a reason for hiding this comment

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

Needed to publish motsu to crates.io; requirement for cargo publish -p motsu --dry-run

e2e = { path = "lib/e2e" }
e2e-proc = {path = "lib/e2e-proc"}

[profile.release]
codegen-units = 1
panic = "abort"
Expand Down
6 changes: 3 additions & 3 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-stylus = { path = "../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives = { workspace = true, features = ["tiny-keccak"] }
alloy.workspace = true
tokio.workspace = true
eyre.workspace = true
koba.workspace = true
e2e = { path = "../lib/e2e" }
e2e.workspace = true
serde = "1.0.203"
keccak-const = "0.2.0"
4 changes: 2 additions & 2 deletions contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition.workspace = true
keywords.workspace = true
license.workspace = true
repository.workspace = true
version = "0.1.0-rc"
version.workspace = true

[dependencies]
alloy-primitives.workspace = true
Expand All @@ -18,7 +18,7 @@ keccak-const.workspace = true

[dev-dependencies]
alloy-primitives = { workspace = true, features = ["arbitrary"] }
motsu = { path = "../lib/motsu" }
motsu.workspace = true
rand.workspace = true

[features]
Expand Down
6 changes: 3 additions & 3 deletions examples/access-control/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-stylus = { path = "../../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives.workspace = true
stylus-sdk.workspace = true
stylus-proc.workspace = true
mini-alloc.workspace = true

[dev-dependencies]
alloy.workspace = true
e2e = { path = "../../lib/e2e" }
e2e.workspace = true
tokio.workspace = true
eyre.workspace = true

Expand Down
4 changes: 2 additions & 2 deletions examples/basic/token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-stylus = { path = "../../../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives.workspace = true
stylus-sdk.workspace = true
stylus-proc.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions examples/ecdsa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-stylus = { path = "../../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives.workspace = true
stylus-sdk.workspace = true
stylus-proc.workspace = true
mini-alloc.workspace = true

[dev-dependencies]
alloy.workspace = true
e2e = { path = "../../lib/e2e" }
e2e.workspace = true
tokio.workspace = true
eyre.workspace = true

Expand Down
6 changes: 3 additions & 3 deletions examples/erc20-permit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-stylus = { path = "../../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives = { workspace = true, features = ["tiny-keccak"] }
stylus-sdk.workspace = true
stylus-proc.workspace = true
Expand All @@ -17,7 +17,7 @@ mini-alloc.workspace = true
alloy.workspace = true
eyre.workspace = true
tokio.workspace = true
e2e = { path = "../../lib/e2e" }
e2e.workspace = true

[features]
e2e = []
Expand Down
6 changes: 3 additions & 3 deletions examples/erc20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-stylus = { path = "../../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives.workspace = true
stylus-sdk.workspace = true
stylus-proc.workspace = true
Expand All @@ -17,7 +17,7 @@ mini-alloc.workspace = true
alloy.workspace = true
eyre.workspace = true
tokio.workspace = true
e2e = { path = "../../lib/e2e" }
e2e.workspace = true

[features]
e2e = []
Expand Down
6 changes: 3 additions & 3 deletions examples/erc721-consecutive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-stylus = { path = "../../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives.workspace = true
alloy-sol-types.workspace = true
stylus-sdk.workspace = true
Expand All @@ -16,7 +16,7 @@ mini-alloc.workspace = true

[dev-dependencies]
alloy.workspace = true
e2e = { path = "../../lib/e2e" }
e2e.workspace = true
tokio.workspace = true
eyre.workspace = true
rand.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions examples/erc721-metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-stylus = { path = "../../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives.workspace = true
stylus-sdk.workspace = true
stylus-proc.workspace = true
mini-alloc.workspace = true

[dev-dependencies]
alloy.workspace = true
e2e = { path = "../../lib/e2e" }
e2e.workspace = true
tokio.workspace = true
eyre.workspace = true
rand.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions examples/erc721/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-stylus = { path = "../../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives.workspace = true
stylus-sdk.workspace = true
stylus-proc.workspace = true
mini-alloc.workspace = true

[dev-dependencies]
alloy.workspace = true
e2e = { path = "../../lib/e2e" }
e2e.workspace = true
tokio.workspace = true
eyre.workspace = true
rand.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions examples/merkle-proofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
version = "0.0.0"
version.workspace = true

[dependencies]
openzeppelin-crypto = { path = "../../lib/crypto" }
openzeppelin-crypto.workspace = true
alloy-primitives.workspace = true
alloy-sol-types.workspace = true
stylus-sdk.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions examples/ownable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ publish = false
version = "0.0.0"

[dependencies]
openzeppelin-stylus = { path = "../../contracts" }
openzeppelin-stylus.workspace = true
alloy-primitives.workspace = true
stylus-sdk.workspace = true
stylus-proc.workspace = true
mini-alloc.workspace = true

[dev-dependencies]
alloy.workspace = true
e2e = { path = "../../lib/e2e" }
e2e.workspace = true
tokio.workspace = true
eyre.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion lib/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition.workspace = true
keywords.workspace = true
license.workspace = true
repository.workspace = true
version = "0.1.0-rc"
version.workspace = true

[dependencies]
mini-alloc.workspace = true
Expand Down
Loading
Loading