Skip to content

Commit af02841

Browse files
greged93frisitano
andauthored
feat: ci (#18)
* init bridge implementation * extend bridge implementation * refactor and clean up dependencies * add .vscode to .gitignore * lint * spacing * cleanup * wrap inner block import in bridge * add bridge integration test * refactor and clean up * add comments * migrate shared dependencies to workspace * feature propogation * lints and feature fix * remove scroll feature * add scroll feature * integrate reth upstream changes * address PR feedback * add systemd service file * update systemd file * update systemd file * feat: add ci * feat: lints and formatting * feat: add lock file to version control * fix: ci * permission update * feat: cargo docs alias * address comments * feat: reduce CI size for no_std checks * fix: lints + imports * fix: use spaces iso tab * feat: Makefile * fix: small lints * fix: typo --------- Co-authored-by: frisitano <[email protected]>
1 parent 55d8e8c commit af02841

File tree

20 files changed

+10581
-49
lines changed

20 files changed

+10581
-49
lines changed

.cargo/config.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[alias]
2+
docs = "doc --workspace --all-features --no-deps"

.codespellrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[codespell]
2+
skip = .git,target,Cargo.toml,Cargo.lock
3+
ignore-words-list = crate

zepter.yaml renamed to .config/zepter.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ workflows:
1212
# Check that `A` activates the features of `B`.
1313
"propagate-feature",
1414
# These are the features to check:
15-
"--features=std,optimism,dev,asm-keccak,jemalloc,jemalloc-prof,tracy-allocator,serde-bincode-compat,serde,test-utils,arbitrary,bench",
15+
"--features=std,dev,test-utils,serde-bincode-compat,serde,test-utils,arbitrary,bench",
1616
# 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.
1717
"--left-side-feature-missing=ignore",
1818
# Ignore the case that `A` it outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on.
19-
2019
"--left-side-outside-workspace=ignore",
2120
# Auxilary flags:
2221
"--offline",
@@ -31,11 +30,10 @@ workflows:
3130
# Will be displayed when any workflow fails:
3231
help:
3332
text: |
34-
Reth uses the Zepter CLI to detect abnormalities in Cargo features, e.g. missing propagation.
33+
We uses the Zepter CLI to detect abnormalities in Cargo features, e.g. missing propagation.
3534
3635
It looks like one more checks failed; please check the console output.
3736
3837
You can try to automatically address them by installing zepter (`cargo install zepter --locked`) and simply running `zepter` in the workspace root.
3938
links:
40-
- "https://github.com/paradigmxyz/reth/pull/11888"
4139
- "https://github.com/ggwpez/zepter"

.github/assets/check_no_std.sh

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
set +e # Disable immediate exit on error
3+
4+
crates=($(cargo metadata --format-version=1 --no-deps | jq -r '.packages[].name' | sort))
5+
6+
IFS=',' read -ra exclude_crates <<< "$EXCLUDE"
7+
unset IFS
8+
9+
contains() {
10+
local ex="$1[@]"
11+
local input=$2
12+
13+
for ignore in "${!ex}";
14+
do
15+
if [ "$ignore" = "$input" ];
16+
then
17+
return 0
18+
fi
19+
done
20+
return 1
21+
}
22+
23+
results=()
24+
any_failed=0
25+
26+
for crate in "${crates[@]}";
27+
do
28+
if contains exclude_crates "$crate";
29+
then
30+
results+=("⏭️ $crate")
31+
continue
32+
fi
33+
34+
cmd="cargo +stable build -p $crate --target $TARGET --no-default-features"
35+
36+
set +e # Disable immediate exit on error
37+
# Run the command and capture the return code
38+
$cmd
39+
ret_code=$?
40+
set -e # Re-enable immediate exit on error
41+
42+
if [ $ret_code -eq 0 ];
43+
then
44+
results+=("$crate")
45+
else
46+
results+=("$crate")
47+
any_failed=1
48+
fi
49+
done
50+
51+
IFS=$'\n' sorted=$(sort <<< "${results[*]}")
52+
unset IFS
53+
54+
printf "Build results: \n"
55+
for result in "${sorted[@]}";
56+
do
57+
echo "${result}"
58+
done
59+
60+
exit $any_failed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/lint.yaml

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: lint
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
15+
jobs:
16+
clippy:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 30
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: rui314/setup-mold@v1
22+
- uses: dtolnay/rust-toolchain@clippy
23+
with:
24+
components: clippy
25+
- uses: Swatinem/rust-cache@v2
26+
with:
27+
cache-on-failure: true
28+
- name: Run clippy
29+
run: cargo clippy --workspace --lib --examples --tests --benches --all-features --locked
30+
env:
31+
RUSTFLAGS: -D warnings
32+
33+
fmt:
34+
runs-on: ubuntu-latest
35+
timeout-minutes: 10
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: rui314/setup-mold@v1
39+
- uses: dtolnay/rust-toolchain@nightly
40+
with:
41+
components: rustfmt
42+
- name: Run fmt
43+
run: cargo fmt --all --check
44+
45+
udeps:
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 60
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: rui314/setup-mold@v1
51+
- uses: dtolnay/rust-toolchain@nightly
52+
- uses: Swatinem/rust-cache@v2
53+
with:
54+
cache-on-failure: true
55+
- uses: taiki-e/install-action@cargo-udeps
56+
- name: Run udeps
57+
run: cargo udeps --workspace --lib --examples --tests --benches --all-features --locked
58+
59+
zepter:
60+
runs-on: ubuntu-latest
61+
timeout-minutes: 10
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: cargo-bins/cargo-binstall@main
65+
- name: fetch deps
66+
run: |
67+
# Eagerly pull dependencies
68+
cargo metadata --format-version=1 --locked > /dev/null
69+
- name: run zepter
70+
run: |
71+
cargo binstall zepter --force -y --locked
72+
zepter run check
73+
74+
docs:
75+
runs-on: ubuntu-latest
76+
timeout-minutes: 60
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: rui314/setup-mold@v1
80+
- uses: dtolnay/rust-toolchain@nightly
81+
- uses: Swatinem/rust-cache@v2
82+
with:
83+
cache-on-failure: true
84+
- name: Run doc
85+
run: cargo docs --document-private-items
86+
env:
87+
RUSTDOCFLAGS: --cfg docsrs --show-type-layout --generate-link-to-definition --enable-index-page -Zunstable-options -D warnings
88+
89+
codespell:
90+
runs-on: ubuntu-latest
91+
timeout-minutes: 60
92+
steps:
93+
- uses: actions/checkout@v4
94+
- uses: codespell-project/actions-codespell@v2
95+
with:
96+
skip: "*.json"
97+
98+
features:
99+
runs-on: ubuntu-latest
100+
timeout-minutes: 60
101+
steps:
102+
- uses: actions/checkout@v4
103+
- uses: rui314/setup-mold@v1
104+
- uses: dtolnay/rust-toolchain@stable
105+
- uses: taiki-e/install-action@cargo-hack
106+
- uses: Swatinem/rust-cache@v2
107+
with:
108+
cache-on-failure: true
109+
- name: Run feature check
110+
run: cargo hack check --feature-powerset --no-dev-deps
111+
112+
no_std:
113+
runs-on: ubuntu-latest
114+
timeout-minutes: 60
115+
strategy:
116+
matrix:
117+
include:
118+
- type: wasm
119+
target: wasm32-unknown-unknown
120+
exclude: engine,scroll-wire,scroll-bridge,scroll-network
121+
- type: riscv
122+
target: riscv32imac-unknown-none-elf
123+
exclude: engine,scroll-wire,scroll-bridge,scroll-network
124+
steps:
125+
- uses: actions/checkout@v4
126+
- uses: rui314/setup-mold@v1
127+
- uses: dcarbone/install-jq-action@v3
128+
- uses: dtolnay/rust-toolchain@stable
129+
with:
130+
targets: ${{ matrix.target }}
131+
- uses: Swatinem/rust-cache@v2
132+
with:
133+
cache-on-failure: true
134+
- name: Run no_std check
135+
run: |
136+
sudo apt update && sudo apt install gcc-multilib
137+
.github/assets/check_no_std.sh
138+
env:
139+
TARGET: ${{ matrix.target }}
140+
EXCLUDE: ${{ matrix.exclude }}

.github/workflows/test.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
15+
jobs:
16+
unit:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 60
19+
env:
20+
RUST_BACKTRACE: 1
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: rui314/setup-mold@v1
24+
- uses: dtolnay/rust-toolchain@nightly
25+
with:
26+
toolchain: 'nightly'
27+
- uses: Swatinem/rust-cache@v2
28+
with:
29+
cache-on-failure: true
30+
- uses: taiki-e/install-action@nextest
31+
- name: Run unit tests
32+
run: cargo nextest run --all-features --workspace --locked -E '!kind(test)'
33+
34+
integration:
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 60
37+
env:
38+
RUST_BACKTRACE: 1
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: rui314/setup-mold@v1
42+
- uses: dtolnay/rust-toolchain@nightly
43+
with:
44+
toolchain: 'nightly'
45+
- uses: Swatinem/rust-cache@v2
46+
with:
47+
cache-on-failure: true
48+
- uses: taiki-e/install-action@nextest
49+
- name: Run integration tests
50+
run: cargo nextest run --all-features --workspace --locked --no-tests=pass -E 'kind(test)'

.gitignore

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
debug/
44
target/
55

6-
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
7-
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
8-
Cargo.lock
9-
106
# These are backup files generated by rustfmt
117
**/*.rs.bk
128

@@ -24,4 +20,6 @@ Cargo.lock
2420

2521
/target
2622

27-
.vscode/
23+
.vscode/
24+
25+
.idea/

0 commit comments

Comments
 (0)