From 5687dd3bde43143adb20470409ba1c2cb78bf777 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Wed, 16 Aug 2023 14:26:07 +0300 Subject: [PATCH 01/14] Split `create_program` into two versions --- Cargo.toml | 4 +- src/functions.rs | 10 ++++- src/generated/create_program.rs | 76 ++++++++++++++++++++++++++++++--- src/lib.rs | 5 ++- 4 files changed, 86 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c6468bc..2c77410 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,9 @@ keywords = ["gstd", "smart-contracts", "gear-tech", "gear-foundation"] categories = ["api-bindings", "no-std"] [dependencies] -gstd = { git = "https://github.com/gear-tech/gear.git", rev = "946ac47" } +gstd = { git = "https://github.com/gear-tech/gear.git", rev = "bf049db" } [features] +default = ["panic-handler"] +panic-handler = ["gstd/panic-handler"] debug = ["gstd/debug"] diff --git a/src/functions.rs b/src/functions.rs index 4084e0c..c0ff596 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -46,9 +46,17 @@ pub fn send_input>( } /// Creates a builder that allows to create a new program from the already existing on-chain code. -pub fn create_program>( +pub fn create_program_bytes>( code_id: CodeId, payload: Buffer, ) -> CreateProgramBuilder<(CodeIdW, PayloadBytesW, (), (), ())> { CreateProgramBuilder::bytes(code_id, payload) } + +/// Creates a builder that allows to create a new program from the already existing on-chain code. +pub fn create_program( + code_id: CodeId, + payload: Encodable, +) -> CreateProgramBuilder<(CodeIdW, PayloadEncodableW, (), (), ())> { + CreateProgramBuilder::encode(code_id, payload) +} diff --git a/src/generated/create_program.rs b/src/generated/create_program.rs index 280d60b..b1988c7 100644 --- a/src/generated/create_program.rs +++ b/src/generated/create_program.rs @@ -19,6 +19,14 @@ impl> CreateProgramBuilder<(CodeIdW, PayloadBytesW, } } +impl CreateProgramBuilder<(CodeIdW, PayloadEncodableW, (), (), ())> { + pub fn encode(code_id: CodeId, payload: Encodable) -> Self { + Self { + fields: (CodeIdW(code_id), PayloadEncodableW(payload), (), (), ()), + } + } +} + impl CreateProgramBuilder<(CodeId, Payload, (), Delay, GasLimit)> { pub fn with_value(self, value: u128) -> CreateProgramBuilder<(CodeId, Payload, ValueW, Delay, GasLimit)> { let (code_id, payload, _, delay, gas_limit) = self.fields; @@ -65,27 +73,55 @@ impl CreateProgramBuilder<(CodeId, Payload, Va impl, Value: Into> CreateProgramBuilder<(CodeIdW, PayloadBytesW, Value, (), ())> { pub fn execute(self) -> Result<(MessageId, ActorId)> { let (CodeIdW(code_id), PayloadBytesW(payload), value, _, _) = self.fields; - ProgramGenerator::create_program(code_id, payload, value.into().0) + ProgramGenerator::create_program_bytes(code_id, payload, value.into().0) } } impl, Value: Into> CreateProgramBuilder<(CodeIdW, PayloadBytesW, Value, (), GasLimitW)> { pub fn execute(self) -> Result<(MessageId, ActorId)> { let (CodeIdW(code_id), PayloadBytesW(payload), value, _, GasLimitW(gas_limit)) = self.fields; - ProgramGenerator::create_program_with_gas(code_id, payload, gas_limit, value.into().0) + ProgramGenerator::create_program_bytes_with_gas(code_id, payload, gas_limit, value.into().0) } } impl, Value: Into> CreateProgramBuilder<(CodeIdW, PayloadBytesW, Value, DelayW, ())> { pub fn execute(self) -> Result<(MessageId, ActorId)> { let (CodeIdW(code_id), PayloadBytesW(payload), value, DelayW(delay), _) = self.fields; - ProgramGenerator::create_program_delayed(code_id, payload, value.into().0, delay) + ProgramGenerator::create_program_bytes_delayed(code_id, payload, value.into().0, delay) } } impl, Value: Into> CreateProgramBuilder<(CodeIdW, PayloadBytesW, Value, DelayW, GasLimitW)> { pub fn execute(self) -> Result<(MessageId, ActorId)> { let (CodeIdW(code_id), PayloadBytesW(payload), value, DelayW(delay), GasLimitW(gas_limit)) = self.fields; + ProgramGenerator::create_program_bytes_with_gas_delayed(code_id, payload, gas_limit, value.into().0, delay) + } +} + +impl> CreateProgramBuilder<(CodeIdW, PayloadEncodableW, Value, (), ())> { + pub fn execute(self) -> Result<(MessageId, ActorId)> { + let (CodeIdW(code_id), PayloadEncodableW(payload), value, _, _) = self.fields; + ProgramGenerator::create_program(code_id, payload, value.into().0) + } +} + +impl> CreateProgramBuilder<(CodeIdW, PayloadEncodableW, Value, (), GasLimitW)> { + pub fn execute(self) -> Result<(MessageId, ActorId)> { + let (CodeIdW(code_id), PayloadEncodableW(payload), value, _, GasLimitW(gas_limit)) = self.fields; + ProgramGenerator::create_program_with_gas(code_id, payload, gas_limit, value.into().0) + } +} + +impl> CreateProgramBuilder<(CodeIdW, PayloadEncodableW, Value, DelayW, ())> { + pub fn execute(self) -> Result<(MessageId, ActorId)> { + let (CodeIdW(code_id), PayloadEncodableW(payload), value, DelayW(delay), _) = self.fields; + ProgramGenerator::create_program_delayed(code_id, payload, value.into().0, delay) + } +} + +impl> CreateProgramBuilder<(CodeIdW, PayloadEncodableW, Value, DelayW, GasLimitW)> { + pub fn execute(self) -> Result<(MessageId, ActorId)> { + let (CodeIdW(code_id), PayloadEncodableW(payload), value, DelayW(delay), GasLimitW(gas_limit)) = self.fields; ProgramGenerator::create_program_with_gas_delayed(code_id, payload, gas_limit, value.into().0, delay) } } @@ -111,27 +147,55 @@ impl CreateProgramBuilderForReply<( impl, Value: Into, ReplyDeposit: Into> CreateProgramBuilderForReply<(CodeIdW, PayloadBytesW, Value, (), ReplyDeposit, ())> { pub fn execute(self) -> Result { let (CodeIdW(code_id), PayloadBytesW(payload), value, _, reply_deposit, _) = self.fields; - ProgramGenerator::create_program_for_reply(code_id, payload, value.into().0, reply_deposit.into().0) + ProgramGenerator::create_program_bytes_for_reply(code_id, payload, value.into().0, reply_deposit.into().0) } } impl, Value: Into, ReplyDeposit: Into> CreateProgramBuilderForReply<(CodeIdW, PayloadBytesW, Value, GasLimitW, ReplyDeposit, ())> { pub fn execute(self) -> Result { let (CodeIdW(code_id), PayloadBytesW(payload), value, GasLimitW(gas_limit), reply_deposit, _) = self.fields; - ProgramGenerator::create_program_with_gas_for_reply(code_id, payload, gas_limit, value.into().0, reply_deposit.into().0) + ProgramGenerator::create_program_bytes_with_gas_for_reply(code_id, payload, gas_limit, value.into().0, reply_deposit.into().0) } } impl, Value: Into, ReplyDeposit: Into, Decodable: Decode> CreateProgramBuilderForReply<(CodeIdW, PayloadBytesW, Value, (), ReplyDeposit, DecodableW)> { pub fn execute(self) -> Result> { let (CodeIdW(code_id), PayloadBytesW(payload), value, _, reply_deposit, _) = self.fields; - ProgramGenerator::create_program_for_reply_as(code_id, payload, value.into().0, reply_deposit.into().0) + ProgramGenerator::create_program_bytes_for_reply_as(code_id, payload, value.into().0, reply_deposit.into().0) } } impl, Value: Into, ReplyDeposit: Into, Decodable: Decode> CreateProgramBuilderForReply<(CodeIdW, PayloadBytesW, Value, GasLimitW, ReplyDeposit, DecodableW)> { pub fn execute(self) -> Result> { let (CodeIdW(code_id), PayloadBytesW(payload), value, GasLimitW(gas_limit), reply_deposit, _) = self.fields; + ProgramGenerator::create_program_bytes_with_gas_for_reply_as(code_id, payload, gas_limit, value.into().0, reply_deposit.into().0) + } +} + +impl, ReplyDeposit: Into> CreateProgramBuilderForReply<(CodeIdW, PayloadEncodableW, Value, (), ReplyDeposit, ())> { + pub fn execute(self) -> Result { + let (CodeIdW(code_id), PayloadEncodableW(payload), value, _, reply_deposit, _) = self.fields; + ProgramGenerator::create_program_for_reply(code_id, payload, value.into().0, reply_deposit.into().0) + } +} + +impl, ReplyDeposit: Into> CreateProgramBuilderForReply<(CodeIdW, PayloadEncodableW, Value, GasLimitW, ReplyDeposit, ())> { + pub fn execute(self) -> Result { + let (CodeIdW(code_id), PayloadEncodableW(payload), value, GasLimitW(gas_limit), reply_deposit, _) = self.fields; + ProgramGenerator::create_program_with_gas_for_reply(code_id, payload, gas_limit, value.into().0, reply_deposit.into().0) + } +} + +impl, ReplyDeposit: Into, Decodable: Decode> CreateProgramBuilderForReply<(CodeIdW, PayloadEncodableW, Value, (), ReplyDeposit, DecodableW)> { + pub fn execute(self) -> Result> { + let (CodeIdW(code_id), PayloadEncodableW(payload), value, _, reply_deposit, _) = self.fields; + ProgramGenerator::create_program_for_reply_as(code_id, payload, value.into().0, reply_deposit.into().0) + } +} + +impl, ReplyDeposit: Into, Decodable: Decode> CreateProgramBuilderForReply<(CodeIdW, PayloadEncodableW, Value, GasLimitW, ReplyDeposit, DecodableW)> { + pub fn execute(self) -> Result> { + let (CodeIdW(code_id), PayloadEncodableW(payload), value, GasLimitW(gas_limit), reply_deposit, _) = self.fields; ProgramGenerator::create_program_with_gas_for_reply_as(code_id, payload, gas_limit, value.into().0, reply_deposit.into().0) } } diff --git a/src/lib.rs b/src/lib.rs index ccde9c1..72f87ba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -125,7 +125,10 @@ //! //! // This is pseudo-code to show all possible methods //! fn how_to_use_create_program() { -//! builder::create_program(CodeId::default(), b"payload") +//! // Supported functions: +//! // - `builder::create_program(...)` +//! // - `builder::create_program_bytes(...)` +//! builder::create_program(CodeId::default(), String::from("payload")) //! // Possible methods (stage 1): //! .with_value(1) //! .with_delay(2) From 1ada9d1dfdcd70b554960ccbcd77e274ea1def03 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Thu, 31 Aug 2023 16:50:53 +0300 Subject: [PATCH 02/14] use version 0.3.2 for this repo --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2c77410..b9d18b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gstd-fluent" -version = "0.1.0" +version = "0.3.2" authors = ["Gear Technologies"] edition = "2021" description = "A wrapper over gstd that provides a fluent interface to interact with the Gear Protocol" @@ -10,7 +10,7 @@ keywords = ["gstd", "smart-contracts", "gear-tech", "gear-foundation"] categories = ["api-bindings", "no-std"] [dependencies] -gstd = { git = "https://github.com/gear-tech/gear.git", rev = "bf049db" } +gstd = { git = "https://github.com/gear-tech/gear.git", rev = "e9b6d89" } [features] default = ["panic-handler"] From 7c8448f1365c9552776c3d81ba76c5b2eff1fae7 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:54:07 +0300 Subject: [PATCH 03/14] add `default-features = false` to `gstd` --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b9d18b2..868d5d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["gstd", "smart-contracts", "gear-tech", "gear-foundation"] categories = ["api-bindings", "no-std"] [dependencies] -gstd = { git = "https://github.com/gear-tech/gear.git", rev = "e9b6d89" } +gstd = { git = "https://github.com/gear-tech/gear.git", rev = "e9b6d89", default-features = false } [features] default = ["panic-handler"] From d6e3665d26028be366ecf80673d6e0e492975700 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Tue, 16 Jan 2024 23:55:23 +0300 Subject: [PATCH 04/14] move to 1.0.5 --- Cargo.toml | 14 +++++++++++--- rust-toolchain.toml | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 868d5d6..4e18ed2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gstd-fluent" -version = "0.3.2" +version = "1.0.5" authors = ["Gear Technologies"] edition = "2021" description = "A wrapper over gstd that provides a fluent interface to interact with the Gear Protocol" @@ -10,9 +10,17 @@ keywords = ["gstd", "smart-contracts", "gear-tech", "gear-foundation"] categories = ["api-bindings", "no-std"] [dependencies] -gstd = { git = "https://github.com/gear-tech/gear.git", rev = "e9b6d89", default-features = false } +gstd = { git = "https://github.com/gear-tech/gear.git", rev = "d9de34e", default-features = false } [features] -default = ["panic-handler"] +default = ["panic-message"] + panic-handler = ["gstd/panic-handler"] +panic-message = ["gstd/panic-message"] +panic-location = ["gstd/panic-location"] + +nightly = ["gstd/nightly"] +panic-info-message = ["gstd/panic-info-message"] +oom-handler = ["gstd/oom-handler"] + debug = ["gstd/debug"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index bebef8b..a4b4cdc 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2023-04-25" +channel = "nightly-2023-09-05" targets = ["wasm32-unknown-unknown"] profile = "minimal" components = ["rustfmt", "clippy"] From 052655ad59d4955d660ed999b343fd9342067ea2 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:40:36 +0300 Subject: [PATCH 05/14] switch to version from crates io --- Cargo.toml | 4 ++-- src/lib.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4e18ed2..d39626d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gstd-fluent" -version = "1.0.5" +version = "1.1.0" authors = ["Gear Technologies"] edition = "2021" description = "A wrapper over gstd that provides a fluent interface to interact with the Gear Protocol" @@ -10,7 +10,7 @@ keywords = ["gstd", "smart-contracts", "gear-tech", "gear-foundation"] categories = ["api-bindings", "no-std"] [dependencies] -gstd = { git = "https://github.com/gear-tech/gear.git", rev = "d9de34e", default-features = false } +gstd = { version = "=1.1.0", default-features = false } [features] default = ["panic-message"] diff --git a/src/lib.rs b/src/lib.rs index 72f87ba..86ab1e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,8 @@ -//! A wrapper over [`gstd`](https://docs.gear.rs/gstd/) that provides a fluent interface to interact +//! A wrapper over [`gstd`](https://docs.rs/gstd/) that provides a fluent interface to interact //! with the Gear Protocol. //! //! This library can be used instead of the standard library when writing Gear programs. Compared to -//! the [`gstd`](https://docs.gear.rs/gstd/) crate, this library provides higher-level functions +//! the [`gstd`](https://docs.rs/gstd/) crate, this library provides higher-level functions //! that allow you to write Gear programs code in a more convenient way. //! //! ### Example From 34415eb0067197bb2aebb587c07493f81a92133e Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:29:07 +0300 Subject: [PATCH 06/14] update readme --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 450206e..04d6447 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,17 @@ [lic_badge]: https://img.shields.io/badge/License-MIT-success [lic_href]: LICENSE -[docs_badge]: https://img.shields.io/badge/Docs-online-5023dd -[docs_href]: https://dapp.rs/gstd-fluent/gstd_fluent/ +[docs_badge]: https://img.shields.io/badge/Docs-online-5023dd?logo=rust +[docs_href]: https://docs.rs/gstd-fluent/ A wrapper over [gstd](https://github.com/gear-tech/gear/tree/master/gstd) that provides a fluent interface to interact with the Gear Protocol. To use the default implementation, you should replace `gstd` with `gstd-fluent` in your `Cargo.toml` file: -```toml -gstd-fluent = { git = "https://github.com/gear-foundation/gstd-fluent.git" } +```diff +- gstd = "x.y.z" ++ gstd-fluent = "x.y.z" ``` Then update your code like this: From 1b3219155f9b011bbe365b7247533465655eb120 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:33:24 +0300 Subject: [PATCH 07/14] add dependabot --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bc5e930 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "." + schedule: + interval: "daily" + - package-ecosystem: "github-actions" + directory: "." + schedule: + interval: "daily" From f32ffa08ed3015df007e6a3cfaaa1cb108e215f4 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:53:24 +0300 Subject: [PATCH 08/14] remove = --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d39626d..3102b56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["gstd", "smart-contracts", "gear-tech", "gear-foundation"] categories = ["api-bindings", "no-std"] [dependencies] -gstd = { version = "=1.1.0", default-features = false } +gstd = { version = "1.1.0", default-features = false } [features] default = ["panic-message"] From c692c5c801e2e678c29bc242580d350495358408 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:19:19 +0300 Subject: [PATCH 09/14] add more gh actions --- .github/workflows/ci.yml | 19 ++++++++----------- .github/workflows/crates-io.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 25 ++++++++++++++----------- .github/workflows/sync.yml | 31 +++++++++++++++++++++++++++++++ Cargo.toml | 2 +- rust-toolchain.toml | 2 +- 6 files changed, 87 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/crates-io.yml create mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cf6e1c..fcb018c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,28 +10,25 @@ env: jobs: build: - name: Build project runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, '[ci skip]')" - steps: - - name: Checkout code - uses: actions/checkout@v3 + - name: "ACTIONS: Checkout" + uses: actions/checkout@v4 - - name: Install rust toolchain + - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 - - name: Cache + - name: "ACTIONS: Setup caching" uses: Swatinem/rust-cache@v2 - - name: Cargo build + - name: "Build" run: cargo build --release - - name: Cargo test + - name: "Test" run: cargo test --release - - name: Cargo clippy + - name: "Check clippy" run: cargo clippy --release --all-targets -- -D warnings - - name: Cargo fmt + - name: "Check formatting" run: cargo fmt -- --check diff --git a/.github/workflows/crates-io.yml b/.github/workflows/crates-io.yml new file mode 100644 index 0000000..6232130 --- /dev/null +++ b/.github/workflows/crates-io.yml @@ -0,0 +1,32 @@ +name: Crates IO + +on: + workflow_dispatch: + inputs: + publish: + description: "If publish packages" + type: boolean + default: false + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + runs-on: ubuntu-latest + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + steps: + - name: "ACTIONS: Checkout" + uses: actions/checkout@v4 + + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: "Check packages" + if: ${{ !inputs.publish }} + run: cargo publish --dry-run + + - name: "Publish packages" + if: ${{ inputs.publish }} + run: cargo publish diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index da7af9c..8bf0fae 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,34 +17,37 @@ env: jobs: docs: runs-on: ubuntu-latest - if: github.actor != 'dependabot[bot]' steps: - - uses: actions/checkout@v3 + - name: "ACTIONS: Checkout" + uses: actions/checkout@v4 - - name: Cache + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: "ACTIONS: Setup caching" uses: Swatinem/rust-cache@v2 - - name: Test doc examples + - name: "Test: Doc examples" if: github.event_name == 'pull_request' run: cargo test --doc - - name: Build docs + - name: "Build: Docs" env: RUSTDOCFLAGS: --enable-index-page -Zunstable-options run: | cargo doc --no-deps --workspace rm -f target/doc/.lock - - name: Setup GitHub Pages + - name: "ACTIONS: Setup GitHub Pages" if: github.event_name == 'push' - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v4 - - name: Upload Pages artifact + - name: "ACTIONS: Upload Pages artifact" if: github.event_name == 'push' - uses: actions/upload-pages-artifact@v2 + uses: actions/upload-pages-artifact@v3 with: path: target/doc - - name: Deploy to GitHub Pages + - name: "ACTIONS: Deploy to GitHub Pages" if: github.event_name == 'push' - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 0000000..403f4a0 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,31 @@ +name: Sync version + +on: + workflow_dispatch: + +permissions: + contents: write + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: "ACTIONS: Checkout" + uses: actions/checkout@v4 + + - name: "Versioning: Sync version with gstd" + run: | + CRATE_NAME="gstd" + GSTD_VERSION=$(curl -s https://crates.io/api/v1/crates/$CRATE_NAME/versions | jq -r '.versions[] | .num' | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | head -n 1) + + # version = "x.y.z" -> version = "$GSTD_VERSION" + sed -i 's/\(^version = "\)\([0-9]\+\.[0-9]\+\.[0-9]\+\)/\1'$GSTD_VERSION'/' Cargo.toml + # gstd = { version = "=x.y.z", ... } -> gstd = { version = "=x.y.z", ... } + sed -i 's/\(gstd = { version = "=\)\([0-9]\+\.[0-9]\+\.[0-9]\+\)/\1'$GSTD_VERSION'/' Cargo.toml + + - name: "ACTIONS: Create commit" + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: >- + chore(deps): sync with latest gstd version + file_pattern: Cargo.toml diff --git a/Cargo.toml b/Cargo.toml index 3102b56..d39626d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["gstd", "smart-contracts", "gear-tech", "gear-foundation"] categories = ["api-bindings", "no-std"] [dependencies] -gstd = { version = "1.1.0", default-features = false } +gstd = { version = "=1.1.0", default-features = false } [features] default = ["panic-message"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a4b4cdc..4bb9e20 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2023-09-05" +channel = "stable" targets = ["wasm32-unknown-unknown"] profile = "minimal" components = ["rustfmt", "clippy"] From ab87541b97938b90e63796c1af2b323a86f0ba59 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:25:09 +0300 Subject: [PATCH 10/14] migrate to docs.rs instead of dapp.rs --- .github/workflows/ci.yml | 3 +++ .github/workflows/docs.yml | 24 ------------------------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcb018c..0b0529f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,9 @@ jobs: - name: "Test" run: cargo test --release + - name: "Test: Doc examples" + run: cargo test --release --doc + - name: "Check clippy" run: cargo clippy --release --all-targets -- -D warnings diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8bf0fae..a683096 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,10 +1,7 @@ name: Docs on: - push: - branches: [ master ] pull_request: - branches: [ master ] workflow_dispatch: permissions: @@ -30,24 +27,3 @@ jobs: - name: "Test: Doc examples" if: github.event_name == 'pull_request' run: cargo test --doc - - - name: "Build: Docs" - env: - RUSTDOCFLAGS: --enable-index-page -Zunstable-options - run: | - cargo doc --no-deps --workspace - rm -f target/doc/.lock - - - name: "ACTIONS: Setup GitHub Pages" - if: github.event_name == 'push' - uses: actions/configure-pages@v4 - - - name: "ACTIONS: Upload Pages artifact" - if: github.event_name == 'push' - uses: actions/upload-pages-artifact@v3 - with: - path: target/doc - - - name: "ACTIONS: Deploy to GitHub Pages" - if: github.event_name == 'push' - uses: actions/deploy-pages@v4 From c86c585c8a6dc80bd72bbedb6ec5b8dcad6afc3a Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:26:55 +0300 Subject: [PATCH 11/14] rm docs.yml --- .github/workflows/docs.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index a683096..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Docs - -on: - pull_request: - workflow_dispatch: - -permissions: - id-token: write - pages: write - -env: - CARGO_TERM_COLOR: always - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - name: "ACTIONS: Checkout" - uses: actions/checkout@v4 - - - name: "Install: Rust toolchain" - uses: dsherret/rust-toolchain-file@v1 - - - name: "ACTIONS: Setup caching" - uses: Swatinem/rust-cache@v2 - - - name: "Test: Doc examples" - if: github.event_name == 'pull_request' - run: cargo test --doc From e456f9cb51327e344982f909667a2e093f594b81 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:29:31 +0300 Subject: [PATCH 12/14] [ci skip] reformat sync.yml --- .github/workflows/sync.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 403f4a0..34d07e1 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -16,7 +16,11 @@ jobs: - name: "Versioning: Sync version with gstd" run: | CRATE_NAME="gstd" - GSTD_VERSION=$(curl -s https://crates.io/api/v1/crates/$CRATE_NAME/versions | jq -r '.versions[] | .num' | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | head -n 1) + GSTD_VERSION=$( + curl -s https://crates.io/api/v1/crates/$CRATE_NAME/versions | + jq -r '.versions[] | .num' | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | + head -n 1 + ) # version = "x.y.z" -> version = "$GSTD_VERSION" sed -i 's/\(^version = "\)\([0-9]\+\.[0-9]\+\.[0-9]\+\)/\1'$GSTD_VERSION'/' Cargo.toml From 65c80e0f8c8af78eac93ee2717a96961f9a42aae Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Sun, 28 Jan 2024 01:20:27 +0300 Subject: [PATCH 13/14] [ci skip] fix comment --- .github/workflows/sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 34d07e1..711a448 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -24,7 +24,7 @@ jobs: # version = "x.y.z" -> version = "$GSTD_VERSION" sed -i 's/\(^version = "\)\([0-9]\+\.[0-9]\+\.[0-9]\+\)/\1'$GSTD_VERSION'/' Cargo.toml - # gstd = { version = "=x.y.z", ... } -> gstd = { version = "=x.y.z", ... } + # gstd = { version = "=x.y.z", ... } -> gstd = { version = "=$GSTD_VERSION", ... } sed -i 's/\(gstd = { version = "=\)\([0-9]\+\.[0-9]\+\.[0-9]\+\)/\1'$GSTD_VERSION'/' Cargo.toml - name: "ACTIONS: Create commit" From 75a98864f5cb6f6fdc252cfbcdb403e50d7fee3d Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Wed, 24 Apr 2024 19:53:24 +0300 Subject: [PATCH 14/14] bump deps --- Cargo.toml | 4 ++-- rust-toolchain.toml | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d39626d..9c7361f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gstd-fluent" -version = "1.1.0" +version = "1.3.0" authors = ["Gear Technologies"] edition = "2021" description = "A wrapper over gstd that provides a fluent interface to interact with the Gear Protocol" @@ -10,7 +10,7 @@ keywords = ["gstd", "smart-contracts", "gear-tech", "gear-foundation"] categories = ["api-bindings", "no-std"] [dependencies] -gstd = { version = "=1.1.0", default-features = false } +gstd = { version = "=1.3.0", default-features = false } [features] default = ["panic-message"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4bb9e20..a9c63a6 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,4 @@ [toolchain] channel = "stable" targets = ["wasm32-unknown-unknown"] -profile = "minimal" -components = ["rustfmt", "clippy"] +profile = "default"