Skip to content

feat: ci #18

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

Merged
merged 37 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0dd88c6
init bridge implementation
frisitano Jan 21, 2025
bce1586
extend bridge implementation
frisitano Jan 23, 2025
972e9b0
merge main
frisitano Jan 23, 2025
4b5fe5d
refactor and clean up dependencies
frisitano Jan 23, 2025
47e691a
add .vscode to .gitignore
frisitano Jan 23, 2025
72db12a
lint
frisitano Jan 23, 2025
0c4d513
spacing
frisitano Jan 23, 2025
4dbfd84
cleanup
frisitano Jan 23, 2025
cd4e9ed
wrap inner block import in bridge
frisitano Jan 24, 2025
1c28847
add bridge integration test
frisitano Jan 27, 2025
2ca0857
refactor and clean up
frisitano Jan 28, 2025
0140a2d
add comments
frisitano Jan 28, 2025
fe772dc
migrate shared dependencies to workspace
frisitano Jan 28, 2025
f3e4b7a
feature propogation
frisitano Jan 28, 2025
6bc2685
lints and feature fix
frisitano Jan 29, 2025
7e24f45
remove scroll feature
frisitano Jan 29, 2025
2f18f22
add scroll feature
frisitano Jan 30, 2025
b27e28d
integrate reth upstream changes
frisitano Jan 30, 2025
f6740f8
address PR feedback
frisitano Jan 30, 2025
931f6b8
add systemd service file
frisitano Jan 31, 2025
7e8f9d4
update systemd file
frisitano Jan 31, 2025
5c1c639
update systemd file
frisitano Jan 31, 2025
f58ae56
feat: add ci
greged93 Jan 31, 2025
dfd5110
feat: lints and formatting
greged93 Jan 31, 2025
d16d017
feat: add lock file to version control
greged93 Jan 31, 2025
6889749
fix: ci
greged93 Jan 31, 2025
4b5742a
permission update
greged93 Jan 31, 2025
aea1776
feat: cargo docs alias
greged93 Jan 31, 2025
8843970
address comments
frisitano Jan 31, 2025
7292a54
feat: reduce CI size for no_std checks
greged93 Jan 31, 2025
9674c23
Merge branch 'feat/gossip-source' into feat/ci
greged93 Jan 31, 2025
9b79771
fix: lints + imports
greged93 Jan 31, 2025
8267656
fix: use spaces iso tab
greged93 Jan 31, 2025
99b5f12
feat: Makefile
greged93 Jan 31, 2025
b672984
Merge branch 'main' into feat/ci
greged93 Jan 31, 2025
e6694a9
fix: small lints
greged93 Jan 31, 2025
8697e4f
fix: typo
greged93 Jan 31, 2025
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
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
docs = "doc --workspace --all-features --no-deps"
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
skip = .git,target,Cargo.toml,Cargo.lock
ignore-words-list = crate
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,dev,test-utils,serde-bincode-compat,serde,test-utils,arbitrary,bench",
# 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",
# Auxilary flags:
"--offline",
"--locked",
"--show-path",
"--quiet",
]
default:
# Running `zepter` with no subcommand will check & fix.
- [$check.0, "--fix"]

# Will be displayed when any workflow fails:
help:
text: |
We 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"
60 changes: 60 additions & 0 deletions .github/assets/check_no_std.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
set +e # Disable immediate exit on error

crates=($(cargo metadata --format-version=1 --no-deps | jq -r '.packages[].name' | sort))

IFS=',' read -ra exclude_crates <<< "$EXCLUDE"
unset IFS

contains() {
local ex="$1[@]"
local input=$2

for ignore in "${!ex}";
do
if [ "$ignore" = "$input" ];
then
return 0
fi
done
return 1
}

results=()
any_failed=0

for crate in "${crates[@]}";
do
if contains exclude_crates "$crate";
then
results+=("⏭️ $crate")
continue
fi

cmd="cargo +stable build -p $crate --target $TARGET --no-default-features"

set +e # Disable immediate exit on error
# Run the command and capture the return code
# $cmd
ret_code=$?
set -e # Re-enable immediate exit on error

if [ $ret_code -eq 0 ];
then
results+=("✅ $crate")
else
results+=("❌ $crate")
any_failed=1
fi
done

IFS=$'\n' sorted=$(sort <<< "${results[*]}")
unset IFS

printf "Build results: \n"
for result in "${sorted[@]}";
do
echo "${result}"
done

exit $any_failed
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest recommendation for the Rust ecosystem is to add the Cargo.lock file to the version control, and either use dependabot or cargo update && cargo test in CI.
rust-lang/cargo#8728

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
140 changes: 140 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: lint

on:
pull_request:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
clippy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@clippy
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Run clippy
run: cargo clippy --workspace --lib --examples --tests --benches --all-features --locked
env:
RUSTFLAGS: -D warnings

fmt:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Run fmt
run: cargo fmt --all --check

udeps:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@cargo-udeps
- name: Run udeps
run: cargo udeps --workspace --lib --examples --tests --benches --all-features --locked

zepter:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: cargo-bins/cargo-binstall@main
- name: fetch deps
run: |
# Eagerly pull dependencies
cargo metadata --format-version=1 --locked > /dev/null
- name: run zepter
run: |
cargo binstall zepter --force -y --locked
zepter run check

docs:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Run doc
run: cargo docs --document-private-items
env:
RUSTDOCFLAGS: --cfg docsrs --show-type-layout --generate-link-to-definition --enable-index-page -Zunstable-options -D warnings

codespell:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
skip: "*.json"

features:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Run feature check
run: cargo hack check --feature-powerset --no-dev-deps

no_std:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
include:
- type: wasm
target: wasm32-unknown-unknown
exclude: engine,scroll-wire,scroll-bridge,scroll-network
- type: riscv
target: riscv32imac-unknown-none-elf
exclude: engine,scroll-wire,scroll-bridge,scroll-network
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dcarbone/install-jq-action@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Run no_std check
run: |
sudo apt update && sudo apt install gcc-multilib
.github/assets/check_no_std.sh
env:
TARGET: ${{ matrix.target }}
EXCLUDE: ${{ matrix.exclude }}
50 changes: 50 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: test

on:
pull_request:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
unit:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: 'nightly'
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest
- name: Run unit tests
run: cargo nextest run --workspace --locked -E '!kind(test)'

it:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would be preferable to be more verbose and name this integration.

runs-on: ubuntu-latest
timeout-minutes: 60
env:
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: 'nightly'
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest
- name: Run integration tests
run: cargo nextest run --workspace --locked --no-tests=pass -E 'kind(test)'
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

Expand All @@ -23,3 +19,7 @@ Cargo.lock
# Added by cargo

/target

.vscode/

.idea/
Loading