From b91db2941303c617fac92d4b12a4d427269cb35c Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Thu, 10 Oct 2024 09:59:53 +0200 Subject: [PATCH 1/7] prebuild prior to running --- .github/workflows/integration.yml | 9 ++++++--- .github/workflows/test.yml | 3 +++ scripts/run.sh | 26 ++++++++++++++++++++------ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 335c52c..3007dfa 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -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 @@ -22,7 +22,7 @@ jobs: cache-on-failure: true - name: Run examples run: | - # Get the list of runable examples + # Get the list of runnable examples export examples="$( cargo run --example 2>&1 \ | grep -E '^ ' \ @@ -32,9 +32,9 @@ jobs: -e 'geth_local_instance' \ -e 'ipc' \ -e 'ledger_signer' \ - -e 'reth_local_instance' \ -e 'reth_db_layer' \ -e 'reth_db_provider' \ + -e 'reth_local_instance' \ -e 'subscribe_all_logs' \ -e 'subscribe_logs' \ -e 'subscribe_pending_transactions' \ @@ -47,6 +47,9 @@ jobs: | xargs -n1 echo )" + # Build the examples + cargo build --examples --quiet + # Run the examples with the current version of Alloy for example in $examples; do cargo run --example $example --quiet 1>/dev/null diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e88dc1a..d6af7b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,6 +66,9 @@ jobs: | xargs -n1 echo )" + # Build the examples + cargo build --examples --quiet + # Run the examples for example in $examples; do cargo run --example $example --quiet 1>/dev/null diff --git a/scripts/run.sh b/scripts/run.sh index 72cb5aa..ee0b373 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -7,6 +7,7 @@ set -eo pipefail # # 1. Run all examples with some exceptions. function main () { + export examples="$( cargo run --example 2>&1 \ | grep -E '^ ' \ | grep -v \ @@ -15,6 +16,8 @@ function main () { -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' \ @@ -25,12 +28,23 @@ function main () { -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' + | xargs -n1 echo + )" + + # Build the examples + cargo build --examples --quiet + + # 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 the main function From f395c8bfdfb14a9376900a9136acd54e3d1f6abb Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Thu, 10 Oct 2024 10:04:52 +0200 Subject: [PATCH 2/7] bump to 0.4.1 --- Cargo.toml | 8 ++++---- examples/wallets/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8ad0371..1a1132b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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", @@ -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" diff --git a/examples/wallets/Cargo.toml b/examples/wallets/Cargo.toml index 2cf4b53..a44f35a 100644 --- a/examples/wallets/Cargo.toml +++ b/examples/wallets/Cargo.toml @@ -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"] } From 35a806cbcb9520c0e3b0227400c622d2b2d0e32d Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Thu, 10 Oct 2024 10:50:40 +0200 Subject: [PATCH 3/7] avoid pre-building --- .github/workflows/integration.yml | 3 --- .github/workflows/test.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 3007dfa..8d889d4 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -47,9 +47,6 @@ jobs: | xargs -n1 echo )" - # Build the examples - cargo build --examples --quiet - # Run the examples with the current version of Alloy for example in $examples; do cargo run --example $example --quiet 1>/dev/null diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d6af7b0..e88dc1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,9 +66,6 @@ jobs: | xargs -n1 echo )" - # Build the examples - cargo build --examples --quiet - # Run the examples for example in $examples; do cargo run --example $example --quiet 1>/dev/null From fd39e07521d5610791050d6050e0dce90ee22b3f Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Thu, 10 Oct 2024 11:34:13 +0200 Subject: [PATCH 4/7] use `run.sh` script to gather examples list and run in tests and integration test --- .github/workflows/integration.yml | 49 ++----------------------------- .github/workflows/test.yml | 39 +----------------------- scripts/run.sh | 45 +++++++++++++--------------- 3 files changed, 25 insertions(+), 108 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 8d889d4..257181c 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -22,42 +22,8 @@ jobs: cache-on-failure: true - name: Run examples run: | - # Get the list of runnable 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_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 - )" - - # 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 \ @@ -72,13 +38,4 @@ jobs: 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e88dc1a..97a24d4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/scripts/run.sh b/scripts/run.sh index ee0b373..2fe2055 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -8,32 +8,29 @@ set -eo pipefail # 1. Run all examples with some exceptions. function main () { 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 + 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 )" - # Build the examples - cargo build --examples --quiet - # Run the examples with the current version of Alloy for example in $examples; do cargo run --example $example --quiet 1>/dev/null From 6eebe284f8e23fee7eade2b9c944f1ec9cfe4641 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Thu, 10 Oct 2024 11:36:12 +0200 Subject: [PATCH 5/7] fix indentation --- scripts/run.sh | 54 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/scripts/run.sh b/scripts/run.sh index 2fe2055..a2c1944 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -9,38 +9,38 @@ set -eo pipefail function main () { 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 + | 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 )" # Run the examples with the current version of Alloy for example in $examples; do - cargo run --example $example --quiet 1>/dev/null + 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 + if [ $? -ne 0 ]; then + echo "Failed to run: $example" + exit 1 + else + echo "Successfully ran: $example" + fi done } From dcdc43781d112cc6a3bdd5f73565cc141c665bb7 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Thu, 10 Oct 2024 11:37:44 +0200 Subject: [PATCH 6/7] clean up --- scripts/run.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/run.sh b/scripts/run.sh index a2c1944..b0aeda6 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -1,11 +1,13 @@ #!/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 () { export examples="$( cargo run --example 2>&1 \ @@ -31,7 +33,6 @@ function main () { | 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 @@ -44,6 +45,6 @@ function main () { 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 \ No newline at end of file From 41dada992e3f6ec2da9435b14a4f29fce91dd99e Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Thu, 10 Oct 2024 11:42:37 +0200 Subject: [PATCH 7/7] ignore version tag, fix integration test --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 257181c..fc50bc7 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -31,7 +31,7 @@ jobs: | 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