move examples to main repo so we can include_str them for publishing (#993)

* move exampels to main repo so we can include_str them for publishing

* update CI to not break examples
This commit is contained in:
James Wilson authored and GitHub committed 2023-06-01 14:27:12 +01:00
1 parent 15a267cc5a
commit e40a8629e2
31 files changed
+31 -55

No files matched your search

+10 -2
View File
@@ -53,8 +53,16 @@ jobs:
crate: cargo-hack
version: 0.5
- name: Cargo check
run: cargo hack --exclude-all-features --each-feature check --all-targets --workspace
# A basic check over all targets together. This may lead to features being combined etc,
# and doesn't test combinations of different features.
- name: Cargo check all targets.
run: cargo check --all-targets
# Next, check each feature on its own and compile each crate separately. This is no good
# for subxt/examples, which expect default features to be enabled, hence the above check
# and why we don'#t do `--all-targets` for this one.
- name: Cargo hack; check each feature/crate on its own
run: cargo hack --exclude-all-features --each-feature check --workspace
fmt:
name: Cargo fmt
Generated
-11
View File
@@ -3462,17 +3462,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "subxt-examples"
version = "0.29.0"
dependencies = [
"futures",
"hex",
"sp-keyring",
"subxt",
"tokio",
]
[[package]]
name = "subxt-macro"
version = "0.29.0"
-1
View File
@@ -2,7 +2,6 @@
members = [
"cli",
"codegen",
"examples",
"testing/substrate-runner",
"testing/test-runtime",
"testing/integration-tests",
-20
View File
@@ -1,20 +0,0 @@
[package]
name = "subxt-examples"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
publish = false
license.workspace = true
repository.workspace = true
documentation.workspace = true
homepage.workspace = true
description = "Subxt example usage"
[dev-dependencies]
subxt = { workspace = true }
tokio = { workspace = true }
futures = { workspace = true }
hex = { workspace = true }
sp-keyring = { workspace = true }
+2 -2
View File
@@ -1,5 +1,5 @@
# Subxt Examples
Take a look in the [examples](./examples) subfolder for various `subxt` usage examples.
Each folder here contains a complete example which makes use of subxt in some way.
All examples form part of the `subxt` documentation; there should be no examples without corresponding links from the docs.
For smaller single-file examples, see the `./subxt/examples` folder.
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.
+1 -1
View File
@@ -64,7 +64,7 @@
//! accounts, Alice to Bob:
//!
//! ```rust,ignore
#![doc = include_str!("../../../examples/examples/tx_basic.rs")]
#![doc = include_str!("../../examples/tx_basic.rs")]
//! ```
//!
//! This example assumes that a Polkadot node is running locally (Subxt endeavors to support all
+3 -3
View File
@@ -36,18 +36,18 @@
//! Defining some custom config based off the default Substrate config:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/setup_client_custom_config.rs")]
#![doc = include_str!("../../../examples/setup_client_custom_config.rs")]
//! ```
//!
//! Writing a custom [`crate::rpc::RpcClientT`] implementation:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/setup_client_custom_rpc.rs")]
#![doc = include_str!("../../../examples/setup_client_custom_rpc.rs")]
//! ```
//!
//! Creating an [`crate::OfflineClient`]:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/setup_client_offline.rs")]
#![doc = include_str!("../../../examples/setup_client_offline.rs")]
//! ```
//!
+1 -1
View File
@@ -34,6 +34,6 @@
//! can decode the extrinsics and access various details, including the associated events:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/blocks_subscribing.rs")]
#![doc = include_str!("../../../examples/blocks_subscribing.rs")]
//! ```
//!
+2 -2
View File
@@ -49,12 +49,12 @@
//! Here's an example using a static query:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/constants_static.rs")]
#![doc = include_str!("../../../examples/constants_static.rs")]
//! ```
//!
//! And here's one using a dynamic query:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/constants_dynamic.rs")]
#![doc = include_str!("../../../examples/constants_dynamic.rs")]
//! ```
//!
+1 -1
View File
@@ -44,6 +44,6 @@
//! Here's an example which puts this all together:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/events.rs")]
#![doc = include_str!("../../../examples/events.rs")]
//! ```
//!
+3 -3
View File
@@ -58,7 +58,7 @@
//! The easiest way to make a runtime API call is to use the statically generated interface.
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/runtime_apis_static.rs")]
#![doc = include_str!("../../../examples/runtime_apis_static.rs")]
//! ```
//!
//! ### Making a dynamic Runtime API call
@@ -67,7 +67,7 @@
//! [`crate::dynamic::runtime_api_call`] method.
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/runtime_apis_dynamic.rs")]
#![doc = include_str!("../../../examples/runtime_apis_dynamic.rs")]
//! ```
//!
//! ### Making a raw call
@@ -77,6 +77,6 @@
//! the argument bytes and manually provide a type for the response bytes to be decoded into.
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/runtime_apis_raw.rs")]
#![doc = include_str!("../../../examples/runtime_apis_raw.rs")]
//! ```
//!
+4 -4
View File
@@ -75,7 +75,7 @@
//! latter will only work for storage queries that have a default value when empty):
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/storage_fetch.rs")]
#![doc = include_str!("../../../examples/storage_fetch.rs")]
//! ```
//!
//! For completeness, below is an example using a dynamic query instead. The return type from a
@@ -83,7 +83,7 @@
//! [`crate::dynamic::Value`], or else the raw bytes can be accessed instead.
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/storage_fetch_dynamic.rs")]
#![doc = include_str!("../../../examples/storage_fetch_dynamic.rs")]
//! ```
//!
//! ### Iterating storage entries
@@ -92,13 +92,13 @@
//! iterate over all of the values stored at that location:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/storage_iterating.rs")]
#![doc = include_str!("../../../examples/storage_iterating.rs")]
//! ```
//!
//! Here's the same logic but using dynamically constructed values instead:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/storage_iterating_dynamic.rs")]
#![doc = include_str!("../../../examples/storage_iterating_dynamic.rs")]
//! ```
//!
//! ### Advanced
+3 -3
View File
@@ -147,7 +147,7 @@
//! inspection. This looks like:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/tx_basic.rs")]
#![doc = include_str!("../../../examples/tx_basic.rs")]
//! ```
//!
//! ### Providing transaction parameters
@@ -156,7 +156,7 @@
//! [`crate::tx::TxClient::sign_and_submit_then_watch`] instead:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/tx_with_params.rs")]
#![doc = include_str!("../../../examples/tx_with_params.rs")]
//! ```
//!
//! This example doesn't wait for the transaction to be included in a block; it just submits it and
@@ -168,7 +168,7 @@
//! the transaction, you can monitor them as they are emitted and react however you choose:
//!
//! ```rust,ignore
#![doc = include_str!("../../../../examples/examples/tx_status_stream.rs")]
#![doc = include_str!("../../../examples/tx_status_stream.rs")]
//! ```
//!
//! Take a look at the API docs for [`crate::tx::TxProgress`], [`crate::tx::TxStatus`] and
+1 -1
View File
@@ -5,7 +5,7 @@
//! Subxt is a library for interacting with Substrate based nodes. Using it looks something like this:
//!
//! ```rust,ignore
#![doc = include_str!("../../examples/examples/tx_basic.rs")]
#![doc = include_str!("../examples/tx_basic.rs")]
//! ```
//!
//! Take a look at [the Subxt guide](book) to learn more about how to use Subxt.