mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Implement crate publishing on CI (#12768)
* implement crate publishing from CI * fix indentation * use resource_group for job exclusivity ensure that at most one instance of the publish-crates job is running at any given time to prevent race conditions * correct publish = false * Remove YAML anchors as GitLab's `extends:` doesn't need it * Temporarily force cache upload for the new jobs * Revert `RUSTY_CACHIER_FORCE_UPLOAD` * pin libp2p-tcp=0.37.0 for sc-telemetry * Revert "pin libp2p-tcp=0.37.0 for sc-telemetry" This reverts commit 29146bfad6c31e8cf0e2f17ad92a71bb81a373af. * always collect generated crates * increase timeout for publish-crates-template * Force upload the new job cache again * Revert "Force upload the new job cache again" This reverts commit 5a5feee1b2c51fdef768b25a76be4c3949ec1c99. * reformat * improve timeout explanation * s/usual/average Co-authored-by: Vladimir Istyufeev <vladimir@parity.io>
This commit is contained in:
committed by
GitHub
parent
3b9d781afc
commit
8751f88fc7
@@ -180,6 +180,25 @@ default:
|
||||
# this job runs only on nightly pipeline with the mentioned variable, against `master` branch
|
||||
- if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "nightly"
|
||||
|
||||
.crates-publishing-template:
|
||||
stage: test
|
||||
extends: .docker-env
|
||||
# collect artifacts even on failure so that we know how the crates were generated (they'll be
|
||||
# generated to the artifacts folder according to SPUB_TMP further down)
|
||||
artifacts:
|
||||
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
|
||||
when: always
|
||||
expire_in: 7 days
|
||||
paths:
|
||||
- artifacts/
|
||||
variables:
|
||||
CRATESIO_API: https://crates.io/api
|
||||
CRATESIO_CRATES_OWNER: parity-crate-owner
|
||||
GH_API: https://api.github.com
|
||||
REPO: substrate
|
||||
REPO_OWNER: paritytech
|
||||
SPUB_TMP: artifacts
|
||||
|
||||
#### stage: .pre
|
||||
|
||||
skip-if-draft:
|
||||
|
||||
Generated
+1
@@ -5189,6 +5189,7 @@ dependencies = [
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"log",
|
||||
"pallet-assets",
|
||||
"pallet-balances",
|
||||
"pallet-staking",
|
||||
"pallet-staking-reward-curve",
|
||||
|
||||
@@ -8,6 +8,7 @@ members = [
|
||||
"bin/node/bench",
|
||||
"bin/node/cli",
|
||||
"bin/node/executor",
|
||||
"bin/node/inspect",
|
||||
"bin/node/primitives",
|
||||
"bin/node/rpc",
|
||||
"bin/node/runtime",
|
||||
@@ -39,11 +40,13 @@ members = [
|
||||
"client/executor/wasmi",
|
||||
"client/executor/wasmtime",
|
||||
"client/finality-grandpa",
|
||||
"client/finality-grandpa/rpc",
|
||||
"client/informant",
|
||||
"client/keystore",
|
||||
"client/merkle-mountain-range",
|
||||
"client/merkle-mountain-range/rpc",
|
||||
"client/network",
|
||||
"client/network/transactions",
|
||||
"client/network-gossip",
|
||||
"client/network/bitswap",
|
||||
"client/network/common",
|
||||
@@ -88,11 +91,13 @@ members = [
|
||||
"frame/child-bounties",
|
||||
"frame/collective",
|
||||
"frame/contracts",
|
||||
"frame/contracts/proc-macro",
|
||||
"frame/contracts/primitives",
|
||||
"frame/conviction-voting",
|
||||
"frame/democracy",
|
||||
"frame/fast-unstake",
|
||||
"frame/try-runtime",
|
||||
"frame/elections-phragmen",
|
||||
"frame/election-provider-multi-phase",
|
||||
"frame/election-provider-support",
|
||||
"frame/election-provider-support/benchmarking",
|
||||
@@ -113,6 +118,7 @@ members = [
|
||||
"frame/nicks",
|
||||
"frame/node-authorization",
|
||||
"frame/offences",
|
||||
"frame/offences/benchmarking",
|
||||
"frame/preimage",
|
||||
"frame/proxy",
|
||||
"frame/nomination-pools",
|
||||
@@ -143,6 +149,7 @@ members = [
|
||||
"frame/support/procedural/tools/derive",
|
||||
"frame/support/test",
|
||||
"frame/support/test/compile_pass",
|
||||
"frame/support/test/pallet",
|
||||
"frame/system",
|
||||
"frame/system/benchmarking",
|
||||
"frame/system/rpc/runtime-api",
|
||||
@@ -174,6 +181,7 @@ members = [
|
||||
"primitives/consensus/babe",
|
||||
"primitives/consensus/common",
|
||||
"primitives/consensus/pow",
|
||||
"primitives/consensus/slots",
|
||||
"primitives/consensus/vrf",
|
||||
"primitives/core",
|
||||
"primitives/core/hashing",
|
||||
@@ -215,6 +223,7 @@ members = [
|
||||
"primitives/version/proc-macro",
|
||||
"primitives/wasm-interface",
|
||||
"primitives/weights",
|
||||
"test-utils",
|
||||
"test-utils/client",
|
||||
"test-utils/derive",
|
||||
"test-utils/runtime",
|
||||
|
||||
@@ -7,6 +7,7 @@ edition = "2021"
|
||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
publish = false
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
default-run = "substrate"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
publish = false
|
||||
|
||||
[package.metadata.wasm-pack.profile.release]
|
||||
# `wasm-opt` has some problems on linux, see
|
||||
|
||||
@@ -7,6 +7,7 @@ edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,6 +7,7 @@ edition = "2021"
|
||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,6 +7,7 @@ edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,6 +7,7 @@ edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -8,6 +8,7 @@ build = "build.rs"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
publish = true
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Node-specific RPC methods for interaction with Merkle Mountain Range pallet."
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -8,7 +8,6 @@ edition = "2021"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
documentation = "https://docs.rs/sc-network-bitswap"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -8,7 +8,6 @@ edition = "2021"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
documentation = "https://docs.rs/sc-network-sync"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -8,7 +8,6 @@ edition = "2021"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
documentation = "https://docs.rs/sc-network-light"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -8,7 +8,6 @@ edition = "2021"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
documentation = "https://docs.rs/sc-network-sync"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -8,7 +8,6 @@ edition = "2021"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
documentation = "https://docs.rs/sc-network-transactions"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME pallet bags list"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Fuzzer for FRAME pallet bags list"
|
||||
readme = "README.md"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -7,7 +7,7 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME pallet bags list remote test"
|
||||
readme = "README.md"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "PALLET two phase election providers"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "election provider supporting traits"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Unlicense"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME fast unstake pallet"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
@@ -26,7 +25,10 @@ sp-std = { version = "5.0.0", default-features = false, path = "../../primitives
|
||||
sp-staking = { default-features = false, path = "../../primitives/staking" }
|
||||
frame-election-provider-support = { default-features = false, path = "../election-provider-support" }
|
||||
|
||||
# optional dependencies for cargo features
|
||||
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" }
|
||||
pallet-staking = { default-features = false, optional = true, path = "../staking" }
|
||||
pallet-assets = { default-features = false, optional = true, path = "../assets" }
|
||||
|
||||
[dev-dependencies]
|
||||
pallet-staking-reward-curve = { version = "4.0.0-dev", path = "../staking/reward-curve" }
|
||||
@@ -36,6 +38,7 @@ sp-tracing = { version = "6.0.0", path = "../../primitives/tracing" }
|
||||
pallet-staking = { path = "../staking" }
|
||||
pallet-balances = { path = "../balances" }
|
||||
pallet-timestamp = { path = "../timestamp" }
|
||||
pallet-assets = { path = "../assets" }
|
||||
|
||||
|
||||
[features]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME Participation Lottery Pallet"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -31,6 +31,7 @@ sp-runtime = { version = "7.0.0", default-features = false, path = "../../../pri
|
||||
sp-runtime-interface = { version = "7.0.0", default-features = false, path = "../../../primitives/runtime-interface" }
|
||||
sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/staking" }
|
||||
sp-std = { version = "5.0.0", default-features = false, path = "../../../primitives/std" }
|
||||
sp-io = { optional = true, default-features = false, path = "../../../primitives/io" }
|
||||
|
||||
[dev-dependencies]
|
||||
pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../balances" }
|
||||
|
||||
@@ -7,6 +7,7 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME nomination pools pallet tests with the staking pallet"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME pallet for storing preimages of hashes"
|
||||
readme = "README.md"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
|
||||
@@ -8,6 +8,7 @@ homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME root testing pallet"
|
||||
readme = "README.md"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -32,9 +32,10 @@ sp-application-crypto = { version = "7.0.0", default-features = false, path = ".
|
||||
frame-election-provider-support = { version = "4.0.0-dev", default-features = false, path = "../election-provider-support" }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
|
||||
# Optional imports for benchmarking
|
||||
# optional dependencies for cargo features
|
||||
frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../benchmarking", optional = true }
|
||||
rand_chacha = { version = "0.2", default-features = false, optional = true }
|
||||
pallet-bags-list = { default-features = false, optional = true, path = "../bags-list" }
|
||||
|
||||
[dev-dependencies]
|
||||
sp-tracing = { version = "6.0.0", path = "../../primitives/tracing" }
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME pallet migration of trie"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -19,10 +19,12 @@ sp-io = { version = "7.0.0", default-features = false, path = "../../../primitiv
|
||||
sp-runtime = { version = "7.0.0", default-features = false, path = "../../../primitives/runtime" }
|
||||
sp-std = { version = "5.0.0", default-features = false, path = "../../../primitives/std" }
|
||||
|
||||
# optional dependencies for cargo features
|
||||
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" }
|
||||
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" }
|
||||
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, path = ".." }
|
||||
frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../../benchmarking", optional = true }
|
||||
pallet-assets = { default-features = false, optional = true, path = "../../assets" }
|
||||
|
||||
# Other dependencies
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME pallet for democracy"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "FRAME pallet for whitelisting call, and dispatch from specific origin"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate"
|
||||
description = "Primitives for BEEFY protocol."
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -8,7 +8,6 @@ homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Types and traits for interfacing between the host and the wasm runtime."
|
||||
documentation = "https://docs.rs/sp-wasm-interface"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -161,3 +161,41 @@ update-node-template:
|
||||
--template-path "bin/node-template"
|
||||
--github-api-token "$GITHUB_TOKEN"
|
||||
--polkadot-branch "$CI_COMMIT_REF_NAME"
|
||||
|
||||
.publish-crates-template:
|
||||
stage: publish
|
||||
extends: .crates-publishing-template
|
||||
# We don't want multiple jobs racing to publish crates as it's redundant and they might overwrite
|
||||
# the releases of one another. Use resource_group to ensure that at most one instance of this job
|
||||
# is running at any given time.
|
||||
resource_group: crates-publishing
|
||||
variables:
|
||||
# crates.io rate limits crates publishing by 1 per minute, so a delay needs to be inserted
|
||||
# slightly higher than that after publishing each crate. The value is specified in seconds.
|
||||
SPUB_AFTER_PUBLISH_DELAY: 64
|
||||
# We might have to publish lots of crates at a time. Given the 1 minute delay introduced above and
|
||||
# taking into account the 202 (as of Dec 07, 2022) publishable Substrate crates, that would equate
|
||||
# to roughly 202 minutes of delay, or 3h and 22 minutes. As such, the job needs to have a much
|
||||
# higher timeout than average.
|
||||
timeout: 5h
|
||||
script:
|
||||
- rusty-cachier snapshot create
|
||||
- git clone
|
||||
--depth 1
|
||||
--branch "$RELENG_SCRIPTS_BRANCH"
|
||||
https://github.com/paritytech/releng-scripts.git
|
||||
- CRATESIO_TARGET_INSTANCE=default ./releng-scripts/publish-crates
|
||||
- rusty-cachier cache upload
|
||||
|
||||
publish-crates:
|
||||
extends: .publish-crates-template
|
||||
needs:
|
||||
- job: publish-crates-locally
|
||||
artifacts: false
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == "master"
|
||||
|
||||
publish-crates-manual:
|
||||
extends: .publish-crates-template
|
||||
when: manual
|
||||
allow_failure: true
|
||||
|
||||
@@ -394,6 +394,19 @@ cargo-check-each-crate:
|
||||
- if [ "$CI_NODE_INDEX" == 1 ]; then rusty-cachier cache upload; fi
|
||||
parallel: 2
|
||||
|
||||
publish-crates-locally:
|
||||
extends:
|
||||
- .test-refs
|
||||
- .crates-publishing-template
|
||||
script:
|
||||
- rusty-cachier snapshot create
|
||||
- git clone
|
||||
--depth 1
|
||||
--branch "$RELENG_SCRIPTS_BRANCH"
|
||||
https://github.com/paritytech/releng-scripts.git
|
||||
- CRATESIO_TARGET_INSTANCE=local ./releng-scripts/publish-crates
|
||||
- rusty-cachier cache upload
|
||||
|
||||
cargo-check-each-crate-macos:
|
||||
stage: test
|
||||
extends:
|
||||
|
||||
@@ -5,6 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
license = "GPL-3.0"
|
||||
homepage = "https://substrate.io"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,6 +7,7 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Substrate test utilities"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[package]
|
||||
name = "substrate-test-client"
|
||||
description = "Client testing utilities"
|
||||
version = "2.0.1"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
|
||||
@@ -7,6 +7,7 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Substrate test utilities macros"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
proc-macro-crate = "1.1.3"
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Bag threshold generation script for pallet-bag-list"
|
||||
readme = "README.md"
|
||||
|
||||
[dependencies]
|
||||
# FRAME
|
||||
|
||||
@@ -7,7 +7,7 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Bag threshold generation script for pallet-bag-list and kitchensink-runtime."
|
||||
readme = "README.md"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
kitchensink-runtime = { version = "3.0.0-dev", path = "../../../../bin/node/runtime" }
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "An externalities provided environment that can load itself from remote nodes or cached files"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Shared JSON-RPC client"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -7,7 +7,6 @@ license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Cli command runtime testing and dry-running"
|
||||
readme = "README.md"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -365,26 +365,47 @@ fn create_project_cargo_toml(
|
||||
);
|
||||
}
|
||||
|
||||
/// Find a package by the given `manifest_path` in the metadata.
|
||||
/// Find a package by the given `manifest_path` in the metadata. In case it can't be found by its
|
||||
/// manifest_path, fallback to finding it by name; this is necessary during publish because the
|
||||
/// package's manifest path will be *generated* within a specific packaging directory, thus it won't
|
||||
/// be found by its original path anymore.
|
||||
///
|
||||
/// Panics if the package could not be found.
|
||||
fn find_package_by_manifest_path<'a>(
|
||||
pkg_name: &str,
|
||||
manifest_path: &Path,
|
||||
crate_metadata: &'a cargo_metadata::Metadata,
|
||||
) -> &'a cargo_metadata::Package {
|
||||
crate_metadata
|
||||
if let Some(pkg) = crate_metadata.packages.iter().find(|p| p.manifest_path == manifest_path) {
|
||||
return pkg
|
||||
}
|
||||
let pkgs_by_name = crate_metadata
|
||||
.packages
|
||||
.iter()
|
||||
.find(|p| p.manifest_path == manifest_path)
|
||||
.expect("Wasm project exists in its own metadata; qed")
|
||||
.filter(|p| p.name == pkg_name)
|
||||
.collect::<Vec<_>>();
|
||||
let mut pkgs = pkgs_by_name.iter();
|
||||
if let Some(pkg) = pkgs.next() {
|
||||
if pkgs.next().is_some() {
|
||||
panic!(
|
||||
"Found multiple packages matching the name {pkg_name} ({manifest_path:?}): {:?}",
|
||||
pkgs_by_name
|
||||
);
|
||||
} else {
|
||||
return pkg
|
||||
}
|
||||
} else {
|
||||
panic!("Failed to find entry for package {pkg_name} ({manifest_path:?})");
|
||||
}
|
||||
}
|
||||
|
||||
/// Get a list of enabled features for the project.
|
||||
fn project_enabled_features(
|
||||
pkg_name: &str,
|
||||
cargo_manifest: &Path,
|
||||
crate_metadata: &cargo_metadata::Metadata,
|
||||
) -> Vec<String> {
|
||||
let package = find_package_by_manifest_path(cargo_manifest, crate_metadata);
|
||||
let package = find_package_by_manifest_path(pkg_name, cargo_manifest, crate_metadata);
|
||||
|
||||
let std_enabled = package.features.get("std");
|
||||
|
||||
@@ -427,10 +448,11 @@ fn project_enabled_features(
|
||||
|
||||
/// Returns if the project has the `runtime-wasm` feature
|
||||
fn has_runtime_wasm_feature_declared(
|
||||
pkg_name: &str,
|
||||
cargo_manifest: &Path,
|
||||
crate_metadata: &cargo_metadata::Metadata,
|
||||
) -> bool {
|
||||
let package = find_package_by_manifest_path(cargo_manifest, crate_metadata);
|
||||
let package = find_package_by_manifest_path(pkg_name, cargo_manifest, crate_metadata);
|
||||
|
||||
package.features.keys().any(|k| k == "runtime-wasm")
|
||||
}
|
||||
@@ -455,9 +477,10 @@ fn create_project(
|
||||
fs::create_dir_all(wasm_project_folder.join("src"))
|
||||
.expect("Wasm project dir create can not fail; qed");
|
||||
|
||||
let mut enabled_features = project_enabled_features(project_cargo_toml, crate_metadata);
|
||||
let mut enabled_features =
|
||||
project_enabled_features(&crate_name, project_cargo_toml, crate_metadata);
|
||||
|
||||
if has_runtime_wasm_feature_declared(project_cargo_toml, crate_metadata) {
|
||||
if has_runtime_wasm_feature_declared(&crate_name, project_cargo_toml, crate_metadata) {
|
||||
enabled_features.push("runtime-wasm".into());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user