Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): Add feature propagation checks #402

Merged
merged 3 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .config/zepter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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",
# 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: |
Maili 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/op-rs/maili/pull/134"
- "https://github.com/ggwpez/zepter"
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint

on:
pull_request:
merge_group:
push:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
# Check crates correctly propagate features
feature-propagation:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- run: |
cargo install zepter
zepter --version
time zepter run check
10 changes: 10 additions & 0 deletions crates/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ alloy-network.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types-eth.workspace = true
alloy-signer.workspace = true

[features]
std = [
"op-alloy-consensus/std",
"op-alloy-rpc-types/std"
]
serde = [
"op-alloy-consensus/serde",
"op-alloy-rpc-types/serde"
]
15 changes: 10 additions & 5 deletions crates/op-alloy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ op-alloy-rpc-types = { workspace = true, optional = true }
default = ["std", "k256", "serde"]

std = [
"op-alloy-consensus?/std",
"op-alloy-rpc-types?/std",
"op-alloy-rpc-types-engine?/std",
"op-alloy-consensus?/std",
"op-alloy-rpc-types?/std",
"op-alloy-rpc-types-engine?/std",
"op-alloy-network?/std",
"op-alloy-provider?/std"
]

full = [
Expand All @@ -54,8 +56,11 @@ arbitrary = [
]

serde = [
"op-alloy-consensus?/serde",
"op-alloy-rpc-types-engine?/serde",
"op-alloy-consensus?/serde",
"op-alloy-rpc-types-engine?/serde",
"op-alloy-network?/serde",
"op-alloy-provider?/serde",
"op-alloy-rpc-types?/serde"
]

# `no_std` support
Expand Down
8 changes: 8 additions & 0 deletions crates/provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ alloy-rpc-types-engine = { workspace = true, features = ["serde"] }

# misc
async-trait.workspace = true

[features]
std = [
"op-alloy-rpc-types-engine/std"
]
serde = [
"op-alloy-rpc-types-engine/serde"
]
7 changes: 4 additions & 3 deletions crates/rpc-types-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ std = [
"op-alloy-consensus/std",
]
serde = [
"dep:serde",
"dep:alloy-serde",
"alloy-rpc-types-engine/serde",
"dep:serde",
"dep:alloy-serde",
"alloy-rpc-types-engine/serde",
"op-alloy-consensus/serde"
]
arbitrary = [
"std",
Expand Down
12 changes: 8 additions & 4 deletions crates/rpc-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ similar-asserts.workspace = true
[features]
default = ["std"]
std = [
"alloy-network-primitives/std",
"alloy-eips/std",
"alloy-primitives/std",
"alloy-rpc-types-eth/std",
"alloy-network-primitives/std",
"alloy-eips/std",
"alloy-primitives/std",
"alloy-rpc-types-eth/std",
"op-alloy-consensus/std"
]
arbitrary = [
"std",
Expand All @@ -62,3 +63,6 @@ k256 = [
"alloy-rpc-types-eth/k256",
"op-alloy-consensus/k256",
]
serde = [
"op-alloy-consensus/serde"
]
Loading