Skip to content

Commit

Permalink
ci: add zepter and propagate features (#1951)
Browse files Browse the repository at this point in the history
* ci: add zepter and propagate features

* Update .config/zepter.yaml

Co-authored-by: DaniPopes <[email protected]>

---------

Co-authored-by: DaniPopes <[email protected]>
  • Loading branch information
mattsse and DaniPopes authored Jan 27, 2025
1 parent 93a8ed0 commit 0c75536
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 25 deletions.
38 changes: 38 additions & 0 deletions .config/zepter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version:
format: 1
# Minimum zepter version 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 the following comments 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=std,serde,ssz",
# 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",
# limit to the workspace
"--workspace",
"--show-path",
"--quiet",
]
default:
# Running `zepter` with no subcommand will check & fix.
- [$check.0, "--fix"]

# Will be displayed when any workflow fails:
help:
text: |
Alloy uses the Zepter CLI to detect abnormalities in Cargo features, e.g. missing propagation.
It looks like one more checks failed; please check the console output.
You can try to automatically address them by installing zepter (`cargo install zepter --locked`) and simply running `zepter` in the workspace root.
links:
- "https://github.com/ggwpez/zepter"
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ jobs:
components: rustfmt
- run: cargo fmt --all --check

# Check crates correctly propagate features
feature-propagation:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: run zepter
run: |
cargo install zepter -f --locked
zepter --version
time zepter run check
deny:
uses: ithacaxyz/ci/.github/workflows/deny.yml@main

Expand Down
15 changes: 10 additions & 5 deletions crates/consensus-any/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ arbitrary = { workspace = true, features = ["derive"] }

[features]
default = ["std"]
std = ["alloy-eips/std"]
std = [
"alloy-eips/std",
"alloy-consensus/std",
"alloy-serde?/std"
]
arbitrary = ["std", "dep:arbitrary", "alloy-eips/arbitrary"]
serde = [
"dep:serde",
"alloy-primitives/serde",
"dep:alloy-serde",
"alloy-eips/serde",
"dep:serde",
"alloy-primitives/serde",
"dep:alloy-serde",
"alloy-eips/serde",
"alloy-consensus/serde"
]
6 changes: 5 additions & 1 deletion crates/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ tokio = { workspace = true, features = ["macros"] }

[features]
default = ["std"]
std = ["alloy-eips/std", "c-kzg?/std"]
std = [
"alloy-eips/std",
"c-kzg?/std",
"alloy-serde?/std"
]
k256 = ["dep:k256", "alloy-primitives/k256", "alloy-eips/k256"]
kzg = ["dep:c-kzg", "alloy-eips/kzg", "std"]
arbitrary = ["std", "dep:rand", "dep:arbitrary", "alloy-eips/arbitrary"]
Expand Down
11 changes: 6 additions & 5 deletions crates/eips/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ rand.workspace = true
[features]
default = ["std", "kzg-sidecar"]
std = [
"alloy-primitives/std",
"alloy-rlp/std",
"serde?/std",
"c-kzg?/std",
"once_cell?/std",
"alloy-primitives/std",
"alloy-rlp/std",
"serde?/std",
"c-kzg?/std",
"once_cell?/std",
"alloy-serde?/std"
]
serde = [
"dep:alloy-serde",
Expand Down
8 changes: 7 additions & 1 deletion crates/genesis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ serde_json.workspace = true

[features]
default = ["std"]
std = ["alloy-primitives/std", "alloy-serde/std", "serde/std", "alloy-trie/std"]
std = [
"alloy-primitives/std",
"alloy-serde/std",
"serde/std",
"alloy-trie/std",
"alloy-eips/std"
]
7 changes: 6 additions & 1 deletion crates/network-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ rand.workspace = true

[features]
default = ["std"]
std = ["alloy-primitives/std"]
std = [
"alloy-primitives/std",
"alloy-consensus/std",
"alloy-eips/std",
"alloy-serde/std"
]
7 changes: 4 additions & 3 deletions crates/rpc-types-beacon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ similar-asserts.workspace = true

[features]
ssz = [
"dep:ethereum_ssz",
"dep:ethereum_ssz_derive",
"alloy-rpc-types-engine/ssz",
"dep:ethereum_ssz",
"dep:ethereum_ssz_derive",
"alloy-rpc-types-engine/ssz",
"alloy-eips/ssz"
]
15 changes: 13 additions & 2 deletions crates/rpc-types-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,19 @@ jsonwebtoken = { workspace = true, optional = true }

[features]
default = ["jwt", "std", "serde"]
std = ["alloy-consensus/std", "derive_more/std", "strum/std"]
serde = ["dep:serde", "dep:alloy-serde"]
std = [
"alloy-consensus/std",
"derive_more/std",
"strum/std",
"alloy-eips/std",
"alloy-serde?/std"
]
serde = [
"dep:serde",
"dep:alloy-serde",
"alloy-consensus/serde",
"alloy-eips/serde"
]
jwt = ["std", "dep:jsonwebtoken", "dep:rand"]
jsonrpsee-types = ["dep:jsonrpsee-types"]
ssz = ["std", "dep:ethereum_ssz", "dep:ethereum_ssz_derive", "alloy-eips/ssz"]
Expand Down
22 changes: 15 additions & 7 deletions crates/rpc-types-eth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,22 @@ assert_matches.workspace = true

[features]
default = ["std", "serde"]
std = ["alloy-primitives/std", "alloy-consensus/std", "alloy-eips/std"]
std = [
"alloy-primitives/std",
"alloy-consensus/std",
"alloy-eips/std",
"alloy-consensus-any/std",
"alloy-network-primitives/std",
"alloy-serde?/std"
]
serde = [
"dep:serde",
"dep:serde_json",
"dep:alloy-serde",
"alloy-primitives/serde",
"alloy-consensus/serde",
"alloy-eips/serde",
"dep:serde",
"dep:serde_json",
"dep:alloy-serde",
"alloy-primitives/serde",
"alloy-consensus/serde",
"alloy-eips/serde",
"alloy-consensus-any/serde"
]
arbitrary = [
"std",
Expand Down

0 comments on commit 0c75536

Please sign in to comment.