Skip to content

Commit e19375a

Browse files
authored
feat(ci): Add zepter for feature propagation checks (#11)
1 parent 9e643db commit e19375a

File tree

5 files changed

+68
-12
lines changed

5 files changed

+68
-12
lines changed

.config/zepter.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version:
2+
format: 1
3+
# Minimum zepter version that is expected to work. This is just for printing a nice error
4+
# message when someone tries to use an older version.
5+
binary: 0.13.2
6+
7+
# The examples in the following comments assume crate `A` to have a dependency on crate `B`.
8+
workflows:
9+
check:
10+
- [
11+
"lint",
12+
# Check that `A` activates the features of `B`.
13+
"propagate-feature",
14+
# These are the features to check:
15+
"--features=64-bit,m,a,c,test-utils",
16+
# Do not try to add a new section into `[features]` of `A` only because `B` exposes that feature. There are edge-cases where this is still needed, but we can add them manually.
17+
"--left-side-feature-missing=ignore",
18+
# Ignore the case that `A` is outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on.
19+
"--left-side-outside-workspace=ignore",
20+
# Only check normal dependencies.
21+
# Propagating to dev-dependencies leads to compilation issues.
22+
"--dep-kinds=normal:check,dev:ignore",
23+
"--show-path",
24+
"--quiet",
25+
]
26+
default:
27+
# Running `zepter` with no subcommand will check & fix.
28+
- [$check.0, "--fix"]
29+
30+
# Will be displayed when any workflow fails:
31+
help:
32+
text: |
33+
Brisc uses the Zepter CLI to detect abnormalities in Cargo features, e.g. missing propagation.
34+
35+
It looks like one more checks failed; please check the console output.
36+
37+
You can try to automatically address them by installing zepter (`cargo install zepter --locked`) and simply running `zepter` in the workspace root.
38+
links:
39+
- "https://github.com/ggwpez/zepter"

.github/workflows/rust_ci.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,20 @@ jobs:
168168
uses: codecov/test-results-action@v1
169169
with:
170170
token: ${{ secrets.CODECOV_TOKEN }}
171+
172+
zepter:
173+
runs-on: ubuntu-latest
174+
steps:
175+
- uses: actions/checkout@v4
176+
with:
177+
submodules: true
178+
- name: Install zepter
179+
run: |
180+
cargo install zepter -f --locked
181+
zepter --version
182+
- name: Format features
183+
run: |
184+
zepter format features
185+
- name: Lint features
186+
run: |
187+
zepter

crates/emu/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ rstest.workspace = true
2727
criterion.workspace = true
2828

2929
[features]
30-
default = ["64-bit", "m", "a", "c"]
31-
test-utils = ["dep:rstest"]
30+
default = [ "64-bit", "a", "c", "m" ]
31+
test-utils = [ "dep:rstest" ]
3232

3333
# Architecture features
34-
64-bit = ["brisc-hw/64-bit"]
35-
m = ["brisc-hw/m"]
36-
a = ["brisc-hw/a"]
37-
c = ["brisc-hw/c"]
34+
64-bit = [ "brisc-hw/64-bit" ]
35+
m = [ "brisc-hw/m" ]
36+
a = [ "brisc-hw/a" ]
37+
c = [ "brisc-hw/c" ]
3838

3939
[[bench]]
4040
harness = false

crates/hw/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ cfg-if.workspace = true
2525
rstest.workspace = true
2626

2727
[features]
28-
default = ["64-bit", "m", "a", "c"]
28+
default = [ "64-bit", "a", "c", "m" ]
2929

3030
# Architecture features
31-
64-bit = ["brisc-isa/64-bit"]
32-
m = ["brisc-isa/m"]
33-
a = ["brisc-isa/a"]
34-
c = ["brisc-isa/c"]
31+
64-bit = [ "brisc-isa/64-bit" ]
32+
m = [ "brisc-isa/m" ]
33+
a = [ "brisc-isa/a" ]
34+
c = [ "brisc-isa/c" ]

crates/isa/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ num-traits.workspace = true
2121
rstest.workspace = true
2222

2323
[features]
24-
default = ["64-bit", "m", "a", "c"]
24+
default = [ "64-bit", "a", "c", "m" ]
2525
64-bit = []
2626
m = []
2727
a = []

0 commit comments

Comments
 (0)