Skip to content

Commit

Permalink
Add zepter toml linter to CI (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpolaczyk authored Dec 18, 2023
1 parent b2cf2d1 commit 19a111b
Show file tree
Hide file tree
Showing 28 changed files with 504 additions and 26 deletions.
43 changes: 43 additions & 0 deletions .cargo/zepter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This file should be kept updated with the upstream config file:
# https://github.com/paritytech/polkadot-sdk/blob/master/.config/zepter.yaml

version:
format: 1
# Minimum version of the binary that is expected to work. This is just for printing a nice error
# message when someone tries to use an older version.
binary: 0.13.2

# The examples in this file assume crate `A` to have a dependency on crate `B`.
workflows:
check:
- [
'lint',
# Check that `A` activates the features of `B`.
'propagate-feature',
# These are the features to check:
'--features=try-runtime,runtime-benchmarks,std',
# Do not try to add a new section into `[features]` of `A` only because `B` expose that feature. There are edge-cases where this is still needed, but we can add them manually.
'--left-side-feature-missing=ignore',
# Ignore the case that `A` it outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on.
'--left-side-outside-workspace=ignore',
# Some features imply that they activate a specific dependency as non-optional. Otherwise the default behaviour with a `?` is used.
'--feature-enables-dep=try-runtime:frame-try-runtime,runtime-benchmarks:frame-benchmarking',
# Auxillary flags:
'--offline',
'--locked',
'--show-path',
'--quiet',
]
# Same as `check`, but with the `--fix` flag.
default:
- [ $check.0, '--fix' ]

# Will be displayed when any workflow fails:
help:
text: |
Polkadot-SDK uses the Zepter CLI to detect abnormalities in the feature configuration.
It looks like one more more checks failed; please check the console output. You can try to automatically address them by running `zepter`.
Otherwise please ask directly in the Merge Request, GitHub Discussions or on Matrix Chat, thank you.
links:
- "https://github.com/paritytech/polkadot-sdk/issues/1831"
- "https://github.com/ggwpez/zepter"
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,24 @@ jobs:
- name: Clippy
run: SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --all-targets --locked --workspace --features runtime-benchmarks

cargo-toml-feature-propagation:
runs-on: ubuntu-latest
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ needs.set-tags.outputs.git_ref }}

- name: Setup Rust toolchain
run: rustup show

- name: Install zepter
run: cargo install --locked -f zepter

- name: Run zepter
run: zepter run check

typescript-formatting:
runs-on: ubuntu-latest
needs: ["set-tags"]
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

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

18 changes: 17 additions & 1 deletion container-chains/templates/frontier/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,24 @@ substrate-build-script-utils = { workspace = true }

[features]
default = []
runtime-benchmarks = [ "container-chain-template-frontier-runtime/runtime-benchmarks", "pallet-ethereum/runtime-benchmarks", "polkadot-cli/runtime-benchmarks" ]
runtime-benchmarks = [
"container-chain-template-frontier-runtime/runtime-benchmarks",
"pallet-ethereum/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"nimbus-primitives/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-service/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks"
]
try-runtime = [
"container-chain-template-frontier-runtime/try-runtime",
"try-runtime-cli/try-runtime",
"nimbus-primitives/try-runtime",
"pallet-ethereum/try-runtime",
"polkadot-cli/try-runtime",
"polkadot-service/try-runtime",
"sp-runtime/try-runtime"
]
34 changes: 34 additions & 0 deletions container-chains/templates/frontier/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ std = [
"staging-xcm/std",
"tp-consensus/std",
"xcm-primitives/std",
"cumulus-pallet-session-benchmarking/std",
"nimbus-primitives/std",
"num_enum/std",
"pallet-author-inherent/std",
"pallet-root-testing/std",
"pallet-transaction-payment/std",
"serde?/std",
"sp-debug-derive/std",
"sp-session/std",
"sp-trie/std"
]

# Allow to print logs details (no wasm:stripped)
Expand All @@ -186,6 +196,24 @@ runtime-benchmarks = [
"pallet-xcm/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"staging-xcm-builder/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"cumulus-primitives-utility/runtime-benchmarks",
"nimbus-primitives/runtime-benchmarks",
"pallet-author-inherent/runtime-benchmarks",
"pallet-cc-authorities-noting/runtime-benchmarks",
"pallet-evm/runtime-benchmarks",
"pallet-evm-precompile-xcm-utils/runtime-benchmarks",
"pallet-hotfix-sufficients/runtime-benchmarks",
"pallet-migrations/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-tx-pause/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"staging-xcm-executor/runtime-benchmarks",
"xcm-primitives/runtime-benchmarks"
]

try-runtime = [
Expand Down Expand Up @@ -215,4 +243,10 @@ try-runtime = [
"parachain-info/try-runtime",
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
"cumulus-pallet-xcm/try-runtime",
"cumulus-pallet-xcmp-queue/try-runtime",
"pallet-author-inherent/try-runtime",
"pallet-root-testing/try-runtime",
"pallet-xcm/try-runtime"
]
16 changes: 15 additions & 1 deletion container-chains/templates/simple/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,22 @@ substrate-build-script-utils = { workspace = true }

[features]
default = []
runtime-benchmarks = [ "container-chain-template-simple-runtime/runtime-benchmarks", "polkadot-cli/runtime-benchmarks" ]
runtime-benchmarks = [
"container-chain-template-simple-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"nimbus-primitives/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-service/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks"
]
try-runtime = [
"container-chain-template-simple-runtime/try-runtime",
"try-runtime-cli/try-runtime",
"nimbus-primitives/try-runtime",
"polkadot-cli/try-runtime",
"polkadot-service/try-runtime",
"sp-runtime/try-runtime"
]
33 changes: 33 additions & 0 deletions container-chains/templates/simple/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ std = [
"staging-xcm/std",
"tp-consensus/std",
"xcm-primitives/std",
"cumulus-pallet-session-benchmarking/std",
"frame-benchmarking?/std",
"frame-system-benchmarking?/std",
"pallet-root-testing/std",
"pallet-transaction-payment/std",
"serde?/std",
"sp-debug-derive/std",
"sp-session/std",
"sp-trie/std"
]

# Allow to print logs details (no wasm:stripped)
Expand All @@ -153,6 +162,21 @@ runtime-benchmarks = [
"pallet-xcm/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"staging-xcm-builder/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"cumulus-primitives-utility/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"nimbus-primitives/runtime-benchmarks",
"pallet-author-inherent/runtime-benchmarks",
"pallet-migrations/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-tx-pause/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"staging-xcm-executor/runtime-benchmarks",
"xcm-primitives/runtime-benchmarks"
]

try-runtime = [
Expand All @@ -174,4 +198,13 @@ try-runtime = [
"parachain-info/try-runtime",
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
"cumulus-pallet-xcm/try-runtime",
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-try-runtime/try-runtime",
"pallet-author-inherent/try-runtime",
"pallet-migrations/try-runtime",
"pallet-root-testing/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-xcm/try-runtime"
]
13 changes: 12 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,18 @@ substrate-build-script-utils = { workspace = true }

[features]
default = []
runtime-benchmarks = [ "dancebox-runtime/runtime-benchmarks", "polkadot-cli/runtime-benchmarks", "polkadot-service/runtime-benchmarks" ]
runtime-benchmarks = [
"dancebox-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"polkadot-service/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"nimbus-primitives/runtime-benchmarks",
"pallet-configuration/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks"
]
try-runtime = [ "dancebox-runtime/try-runtime", "nimbus-primitives/try-runtime", "pallet-configuration/try-runtime", "polkadot-cli/try-runtime", "polkadot-service/try-runtime", "sp-runtime/try-runtime", "try-runtime-cli/try-runtime" ]

fast-runtime = [ "dancebox-runtime/fast-runtime" ]
27 changes: 26 additions & 1 deletion pallets/author-noting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,36 @@ std = [
"sp-trie/std",
"tp-author-noting-inherent/std",
"tp-traits/std",
"bounded-collections/std",
"hex?/std",
"log/std",
"polkadot-parachain-primitives/std",
"polkadot-primitives/std",
"serde?/std",
"sp-core/std",
"sp-externalities/std",
"sp-inherents/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"sp-version/std",
"test-relay-sproof-builder/std"
]
runtime-benchmarks = [
"cumulus-pallet-parachain-system/runtime-benchmarks",
"frame-benchmarking",
"hex",
"tp-traits/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sp-runtime/runtime-benchmarks"
]
try-runtime = [
"frame-support/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime"
]
try-runtime = [ "frame-support/try-runtime" ]
12 changes: 11 additions & 1 deletion pallets/authority-assignment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,15 @@ std = [
"scale-info/std",
"serde",
"tp-traits/std",
"log/std",
"serde?/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std"
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime"
]
try-runtime = [ "frame-support/try-runtime" ]
10 changes: 9 additions & 1 deletion pallets/authority-mapping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@ std = [
"frame-system/std",
"parity-scale-codec/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std"
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime"
]
try-runtime = [ "frame-support/try-runtime" ]
13 changes: 12 additions & 1 deletion pallets/collator-assignment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,22 @@ std = [
"sp-runtime/std",
"sp-std/std",
"tp-traits/std",
"log/std",
"rand/std",
"rand_chacha/std",
"serde?/std",
"sp-core/std",
"sp-io/std"
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"tp-traits/runtime-benchmarks",
"sp-runtime/runtime-benchmarks"
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime"
]
try-runtime = [ "frame-support/try-runtime" ]
1 change: 1 addition & 0 deletions pallets/collator-assignment/rpc/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ default = [ "std" ]
std = [
"parity-scale-codec/std",
"sp-api/std",
"scale-info/std"
]
20 changes: 18 additions & 2 deletions pallets/configuration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ std = [
"scale-info/std",
"serde/std",
"tp-traits/std",
"log/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std"
]
runtime-benchmarks = [
"frame-benchmarking",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"tp-traits/runtime-benchmarks"
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime"
]
runtime-benchmarks = [ "frame-benchmarking" ]
try-runtime = [ "frame-support/try-runtime" ]
Loading

0 comments on commit 19a111b

Please sign in to comment.