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

fix(ci): integration, simplify maintenance of runnable examples list #151

Merged
merged 7 commits into from
Oct 10, 2024
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
53 changes: 5 additions & 48 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
integration:
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -22,63 +22,20 @@ jobs:
cache-on-failure: true
- name: Run examples
run: |
# Get the list of runable examples
export examples="$(
cargo run --example 2>&1 \
| grep -E '^ ' \
| grep -v \
-e 'any_network' \
-e 'builtin' \
-e 'geth_local_instance' \
-e 'ipc' \
-e 'ledger_signer' \
-e 'reth_local_instance' \
-e 'reth_db_layer' \
-e 'reth_db_provider' \
-e 'subscribe_all_logs' \
-e 'subscribe_logs' \
-e 'subscribe_pending_transactions' \
-e 'trace_call' \
-e 'trace_transaction' \
-e 'trezor_signer' \
-e 'ws_auth' \
-e 'ws' \
-e 'yubi_signer' \
| xargs -n1 echo
)"

# Run the examples with the current version of Alloy
for example in $examples; do
cargo run --example $example --quiet 1>/dev/null

if [ $? -ne 0 ]; then
echo "Failed to run: $example"
exit 1
else
echo "Successfully ran: $example"
fi
done
# Run examples with the current version of Alloy
./scripts/run.sh

# Fetch the latest commit hash of the `main` branch from the Alloy repository
export latest_alloy_commit=$(git ls-remote https://github.com/alloy-rs/alloy.git \
| grep refs/heads/main \
| cut -f 1)

# Use the commit hash to update the rev in Cargo.toml
sed -i '/alloy = { version = "0.1.2", features = \[/,/\] }/s/alloy = { version = "0.1.2",/alloy = { git = "https:\/\/github.com\/alloy-rs\/alloy", rev = "'"$latest_alloy_commit"'",/' \
sed -i '/alloy = { version = "[^"]*", features = \[/,/\] }/s/alloy = { version = "[^"]*",/alloy = { git = "https:\/\/github.com\/alloy-rs\/alloy", rev = "'"$latest_alloy_commit"'",/' \
Cargo.toml

# Update to the latest commit
cargo update

# Run the examples with the latest version of Alloy
for example in $examples; do
cargo run --example $example --quiet 1>/dev/null

if [ $? -ne 0 ]; then
echo "Failed to run: $example"
exit 1
else
echo "Successfully ran: $example"
fi
done
./scripts/run.sh
39 changes: 1 addition & 38 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,41 +39,4 @@ jobs:
with:
cache-on-failure: true
- name: Run examples
run: |
# Get the list of runable examples, excluding the ones listed below
export examples="$(
cargo run --example 2>&1 \
| grep -E '^ ' \
| grep -v \
-e 'any_network' \
-e 'builtin' \
-e 'geth_local_instance' \
-e 'ipc' \
-e 'ledger_signer' \
-e 'reth_local_instance' \
-e 'reth_db_layer' \
-e 'reth_db_provider' \
-e 'subscribe_all_logs' \
-e 'subscribe_logs' \
-e 'subscribe_pending_transactions' \
-e 'trace_call' \
-e 'trace_transaction' \
-e 'trezor_signer' \
-e 'ws_auth' \
-e 'ws' \
-e 'yubi_signer' \
-e 'reth_db_provider' \
| xargs -n1 echo
)"

# Run the examples
for example in $examples; do
cargo run --example $example --quiet 1>/dev/null

if [ $? -ne 0 ]; then
echo "Failed to run: $example"
exit 1
else
echo "Successfully ran: $example"
fi
done
run: ./scripts/run.sh
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ significant_drop_tightening = "allow"
needless_return = "allow"

[workspace.dependencies]
alloy = { version = "0.4.0", features = [
alloy = { version = "0.4.1", features = [
"full",
"node-bindings",
"rpc-types-debug",
Expand All @@ -111,9 +111,9 @@ alloy = { version = "0.4.0", features = [
"eips",
] }

foundry-fork-db = "0.4.0"
revm-primitives = "10.0.0"
revm = "14.0.3"
foundry-fork-db = "0.4"
revm-primitives = "10.0"
revm = "14.0"

# async
futures-util = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/wallets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ workspace = true
alloy.workspace = true

aws-config = { version = "1.5", default-features = false }
aws-sdk-kms = { version = "1.36", default-features = false }
aws-sdk-kms = { version = "1.46", default-features = false }
eyre.workspace = true
rand = "0.8"
serde = { workspace = true, features = ["derive"] }
Expand Down
68 changes: 40 additions & 28 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
#!/usr/bin/env bash

# Exit if anything fails
# Exit if anything fails.
set -eo pipefail

# This script will do the following:
#
# 1. Run all examples with some exceptions.
# 1. Gather all the examples from the output of `cargo run --example` command.
# 2. Filter out the examples that have external dependencies or are not meant to be run.
# 1. Run all examples that are left after filtering.
function main () {
cargo run --example 2>&1 \
| grep -E '^ ' \
| grep -v \
-e 'any_network' \
-e 'builtin' \
-e 'geth_local_instance' \
-e 'ipc' \
-e 'ledger_signer' \
-e 'reth_local_instance' \
-e 'subscribe_all_logs' \
-e 'subscribe_logs' \
-e 'subscribe_pending_transactions' \
-e 'trace_call' \
-e 'trace_transaction' \
-e 'trezor_signer' \
-e 'ws_auth' \
-e 'ws' \
-e 'yubi_signer' \
| xargs -I {} sh -c 'if cargo run --example {} --quiet 1>/dev/null; then \
echo "Successfully ran: {}"; \
else \
echo "Failed to run: {}"; \
cargo run --example {}; \
fi'
export examples="$(
cargo run --example 2>&1 \
| grep -E '^ ' \
| grep -v \
-e 'any_network' \
-e 'builtin' \
-e 'geth_local_instance' \
-e 'ipc' \
-e 'ledger_signer' \
-e 'reth_db_layer' \
-e 'reth_db_provider' \
-e 'reth_local_instance' \
-e 'subscribe_all_logs' \
-e 'subscribe_logs' \
-e 'subscribe_pending_transactions' \
-e 'trace_call' \
-e 'trace_transaction' \
-e 'trezor_signer' \
-e 'ws_auth' \
-e 'ws' \
-e 'yubi_signer' \
| xargs -n1 echo
)"

for example in $examples; do
cargo run --example $example --quiet 1>/dev/null

if [ $? -ne 0 ]; then
echo "Failed to run: $example"
exit 1
else
echo "Successfully ran: $example"
fi
done
}

# Run the main function
# This prevents partial execution in case of incomplete downloads
# Run the main function.
# This prevents partial execution in case of incomplete downloads.
main
Loading