Skip to content

Commit

Permalink
use run.sh script to gather examples list and run in tests and inte…
Browse files Browse the repository at this point in the history
…gration test
  • Loading branch information
zerosnacks committed Oct 10, 2024
1 parent 35a806c commit fd39e07
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 108 deletions.
49 changes: 3 additions & 46 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
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
45 changes: 21 additions & 24 deletions scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fd39e07

Please sign in to comment.