From b14c6114d2a292e36cf6ec9c6dc00e787b199d5e Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 13:10:14 +0000 Subject: [PATCH 01/10] add workflow files --- .github/workflows/ci.yml | 13 +++++++ .github/workflows/dependencies.yml | 61 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/dependencies.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33e10ebb..f2da2af0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,19 @@ concurrency: cancel-in-progress: true jobs: + feature-checks: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: taiki-e/install-action@cargo-hack + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: cargo hack + run: cargo hack check --feature-powerset --depth 2 + clippy: runs-on: ubuntu-latest timeout-minutes: 30 diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml new file mode 100644 index 00000000..336004ed --- /dev/null +++ b/.github/workflows/dependencies.yml @@ -0,0 +1,61 @@ +# Runs `cargo update` periodically. + +name: Update Dependencies + +on: + schedule: + # Run weekly + - cron: "0 0 * * SUN" + workflow_dispatch: + # Needed so we can run it manually + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: cargo-update + TITLE: "chore(deps): weekly `cargo update`" + BODY: | + Automation to keep dependencies in `Cargo.lock` current. + +
cargo update log +

+ + ```log + $cargo_update_log + ``` + +

+
+ +jobs: + update: + name: Update + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + + - name: cargo update + # Remove first line that always just says "Updating crates.io index" + run: cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log + + - name: craft commit message and PR body + id: msg + run: | + export cargo_update_log="$(cat cargo_update.log)" + + echo "commit_message<> $GITHUB_OUTPUT + printf "$TITLE\n\n$cargo_update_log\n" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + echo "body<> $GITHUB_OUTPUT + echo "$BODY" | envsubst >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + add-paths: ./Cargo.lock + commit-message: ${{ steps.msg.outputs.commit_message }} + title: ${{ env.TITLE }} + body: ${{ steps.msg.outputs.body }} + branch: ${{ env.BRANCH }} From 6f3145acacb8c7735cb31730d9e685152f58e0f4 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 13:49:58 +0000 Subject: [PATCH 02/10] fix anvil fork examples, add clarifying comment + add workflow for running all examples --- .github/workflows/ci.yml | 20 +++++++++++++++---- examples/anvil/examples/fork_anvil.rs | 2 +- examples/contracts/examples/generate.rs | 2 +- examples/providers/examples/builder.rs | 6 ++++-- .../examples/event_multiplexer.rs | 5 ++++- .../examples/subscribe_blocks.rs | 5 ++++- .../examples/watch_contract_event.rs | 3 ++- .../transactions/examples/gas_price_usd.rs | 5 ++++- examples/transactions/examples/trace_call.rs | 5 ++++- .../examples/trace_transaction.rs | 5 ++++- .../transactions/examples/transfer_erc20.rs | 5 ++++- .../transactions/examples/transfer_eth.rs | 5 ++++- 12 files changed, 52 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2da2af0..3ab3cb5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,9 +13,9 @@ concurrency: cancel-in-progress: true jobs: - feature-checks: + checks: runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 5 steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -26,9 +26,21 @@ jobs: - name: cargo hack run: cargo hack check --feature-powerset --depth 2 + examples: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - run: | + cargo run --example 2>&1 | grep -E '^ ' | xargs -n1 cargo run --example + clippy: runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 5 steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@clippy @@ -41,7 +53,7 @@ jobs: fmt: runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 5 steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@nightly diff --git a/examples/anvil/examples/fork_anvil.rs b/examples/anvil/examples/fork_anvil.rs index 7dfae3d8..345a8ead 100644 --- a/examples/anvil/examples/fork_anvil.rs +++ b/examples/anvil/examples/fork_anvil.rs @@ -7,7 +7,7 @@ use eyre::Result; async fn main() -> Result<()> { // Spin up a forked Anvil node. // Ensure `anvil` is available in $PATH - let anvil = Anvil::new().fork("https://eth.llamarpc.com").try_spawn()?; + let anvil = Anvil::new().fork("https://eth.merkle.io").try_spawn()?; println!("Anvil running at `{}`", anvil.endpoint()); diff --git a/examples/contracts/examples/generate.rs b/examples/contracts/examples/generate.rs index b5ef21fc..4c7500a5 100644 --- a/examples/contracts/examples/generate.rs +++ b/examples/contracts/examples/generate.rs @@ -14,7 +14,7 @@ sol!( async fn main() -> Result<()> { // Spin up a forked Anvil node. // Ensure `anvil` is available in $PATH - let anvil = Anvil::new().fork("https://eth.llamarpc.com").try_spawn()?; + let anvil = Anvil::new().fork("https://eth.merkle.io").try_spawn()?; // Create a provider. let provider = diff --git a/examples/providers/examples/builder.rs b/examples/providers/examples/builder.rs index 958f9679..e9e0d566 100644 --- a/examples/providers/examples/builder.rs +++ b/examples/providers/examples/builder.rs @@ -12,13 +12,15 @@ use eyre::Result; #[tokio::main] async fn main() -> Result<()> { - // Setup the HTTP transport which is consumed by the RPC client - let anvil = Anvil::new().spawn(); + // Spin up a local Anvil node. + // Ensure `anvil` is available in $PATH + let anvil = Anvil::new().block_time(1).try_spawn()?; let pk = &anvil.keys()[0]; let from = anvil.addresses()[0]; let signer = Wallet::from(pk.to_owned()); + // Setup the HTTP transport which is consumed by the RPC client let rpc_client = RpcClient::new_http(anvil.endpoint().parse().unwrap()); let provider_with_signer = ProviderBuilder::new() .signer(EthereumSigner::from(signer)) diff --git a/examples/subscriptions/examples/event_multiplexer.rs b/examples/subscriptions/examples/event_multiplexer.rs index e0522ea7..8b8ef71b 100644 --- a/examples/subscriptions/examples/event_multiplexer.rs +++ b/examples/subscriptions/examples/event_multiplexer.rs @@ -36,7 +36,10 @@ sol!( #[tokio::main] async fn main() -> Result<()> { - let anvil = Anvil::new().block_time(1).spawn(); + // Spin up a local Anvil node. + // Ensure `anvil` is available in $PATH + let anvil = Anvil::new().block_time(1).try_spawn()?; + let ws = alloy_rpc_client::WsConnect::new(anvil.ws_endpoint()); let provider = RootProvider::::new(RpcClient::connect_pubsub(ws).await?); diff --git a/examples/subscriptions/examples/subscribe_blocks.rs b/examples/subscriptions/examples/subscribe_blocks.rs index 878967ad..bcbb3617 100644 --- a/examples/subscriptions/examples/subscribe_blocks.rs +++ b/examples/subscriptions/examples/subscribe_blocks.rs @@ -8,7 +8,10 @@ use futures_util::{stream, StreamExt}; #[tokio::main] async fn main() -> Result<()> { - let anvil = Anvil::new().block_time(1).spawn(); + // Spin up a local Anvil node. + // Ensure `anvil` is available in $PATH + let anvil = Anvil::new().block_time(1).try_spawn()?; + let ws = alloy_rpc_client::WsConnect::new(anvil.ws_endpoint()); let provider = RootProvider::::new(RpcClient::connect_pubsub(ws).await?); diff --git a/examples/subscriptions/examples/watch_contract_event.rs b/examples/subscriptions/examples/watch_contract_event.rs index 936051f6..91d2ee65 100644 --- a/examples/subscriptions/examples/watch_contract_event.rs +++ b/examples/subscriptions/examples/watch_contract_event.rs @@ -28,7 +28,8 @@ sol!( #[tokio::main] async fn main() -> Result<()> { - let anvil = Anvil::new().block_time(1).spawn(); + let anvil = Anvil::new().block_time(1).try_spawn()?; + let ws = alloy_rpc_client::WsConnect::new(anvil.ws_endpoint()); let provider = RootProvider::::new(RpcClient::connect_pubsub(ws).await?); diff --git a/examples/transactions/examples/gas_price_usd.rs b/examples/transactions/examples/gas_price_usd.rs index 12b41622..6b880750 100644 --- a/examples/transactions/examples/gas_price_usd.rs +++ b/examples/transactions/examples/gas_price_usd.rs @@ -22,7 +22,10 @@ sol!( #[tokio::main] async fn main() -> Result<()> { - let anvil = Anvil::new().fork("https://eth.merkle.io").spawn(); + // Spin up a forked Anvil node. + // Ensure `anvil` is available in $PATH + let anvil = Anvil::new().fork("https://eth.merkle.io").try_spawn()?; + let url = anvil.endpoint().parse().unwrap(); let provider = HttpProvider::::new_http(url); diff --git a/examples/transactions/examples/trace_call.rs b/examples/transactions/examples/trace_call.rs index 752ea540..47ceb047 100644 --- a/examples/transactions/examples/trace_call.rs +++ b/examples/transactions/examples/trace_call.rs @@ -15,7 +15,10 @@ use reqwest::Url; #[tokio::main] async fn main() -> Result<()> { - let anvil = Anvil::new().fork("https://eth.merkle.io").spawn(); + // Spin up a forked Anvil node. + // Ensure `anvil` is available in $PATH + let anvil = Anvil::new().fork("https://eth.merkle.io").try_spawn()?; + let provider = HttpProvider::::new_http("https://eth.merkle.io".parse::().unwrap()); diff --git a/examples/transactions/examples/trace_transaction.rs b/examples/transactions/examples/trace_transaction.rs index 5499129d..e2ee45c5 100644 --- a/examples/transactions/examples/trace_transaction.rs +++ b/examples/transactions/examples/trace_transaction.rs @@ -14,7 +14,10 @@ use eyre::Result; #[tokio::main] async fn main() -> Result<()> { - let anvil = Anvil::new().fork("https://eth.merkle.io").spawn(); + // Spin up a forked Anvil node. + // Ensure `anvil` is available in $PATH + let anvil = Anvil::new().fork("https://eth.merkle.io").try_spawn()?; + let url = anvil.endpoint().parse().unwrap(); let provider = HttpProvider::::new_http(url); let hash = fixed_bytes!("97a02abf405d36939e5b232a5d4ef5206980c5a6661845436058f30600c52df7"); // Hash of the tx we want to trace diff --git a/examples/transactions/examples/transfer_erc20.rs b/examples/transactions/examples/transfer_erc20.rs index b030b68a..1fd021bf 100644 --- a/examples/transactions/examples/transfer_erc20.rs +++ b/examples/transactions/examples/transfer_erc20.rs @@ -15,7 +15,10 @@ sol!(ERC20Example, "examples/contracts/ERC20Example.json"); #[tokio::main] async fn main() -> Result<()> { - let anvil = Anvil::new().fork("https://eth.merkle.io").spawn(); + // Spin up a forked Anvil node. + // Ensure `anvil` is available in $PATH + let anvil = Anvil::new().fork("https://eth.merkle.io").try_spawn()?; + let url = anvil.endpoint().parse().unwrap(); let provider = HttpProvider::::new_http(url); diff --git a/examples/transactions/examples/transfer_eth.rs b/examples/transactions/examples/transfer_eth.rs index a837af73..f0b02b32 100644 --- a/examples/transactions/examples/transfer_eth.rs +++ b/examples/transactions/examples/transfer_eth.rs @@ -11,7 +11,10 @@ use eyre::Result; #[tokio::main] async fn main() -> Result<()> { - let anvil = Anvil::new().fork("https://eth.merkle.io").spawn(); + // Spin up a forked Anvil node. + // Ensure `anvil` is available in $PATH + let anvil = Anvil::new().fork("https://eth.merkle.io").try_spawn()?; + let url = anvil.endpoint().parse().unwrap(); let provider = HttpProvider::::new_http(url); From b2f11c5d6ec5e47027166131fb31ec406a1d9d92 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 14:26:31 +0000 Subject: [PATCH 03/10] add integration workflow --- .github/workflows/dependencies.yml | 4 ++-- .github/workflows/integration.yml | 37 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/integration.yml diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 336004ed..08de92f3 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -1,6 +1,6 @@ -# Runs `cargo update` periodically. +# Runs weeky `cargo update` to keep dependencies current. -name: Update Dependencies +name: Update dependencies on: schedule: diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000..9e991ba5 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,37 @@ +# Runs Alloy integration tests daily to ensure compatibility with the latest version of Alloy. + +name: Alloy integration test + +on: + schedule: + # Run daily + - cron: "0 0 * * *" + workflow_dispatch: + # Needed so we can run it manually + +jobs: + update: + name: Update + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - run: | + # Fetch the latest commit hash of the main branch from the alloy repository + 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 's/\(alloy = { git = "https:\/\/github.com\/alloy-rs\/alloy", rev = "\)[^"]*/\1'"$latest_alloy_commit"'/' \ + Cargo.toml + + # Update to the latest commit + cargo update + + # Run the examples + cargo run --example 2>&1 | grep -E '^ ' | xargs -n1 cargo run --example + \ No newline at end of file From 7b78edd5fc8123210cb1197c62476a3488191593 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 14:38:56 +0000 Subject: [PATCH 04/10] add integration test --- .github/workflows/ci.yml | 16 ++++++++++++++-- .github/workflows/integration.yml | 20 +++++++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ab3cb5a..2e893ea4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: examples: runs-on: ubuntu-latest - timeout-minutes: 5 + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -36,7 +36,19 @@ jobs: with: cache-on-failure: true - run: | - cargo run --example 2>&1 | grep -E '^ ' | xargs -n1 cargo run --example + # Get the list of runable examples + examples="$( + cargo run --example 2>&1 \ + | grep -E '^ ' \ + | grep -v \ + -e 'yubi_signer' \ + -e 'ws' \ + -e 'ws_auth' \ + | xargs -n1 echo + )" + + # Run the examples + echo "$examples" | xargs -n1 cargo run --example clippy: runs-on: ubuntu-latest diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 9e991ba5..3ee3cd60 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -11,8 +11,8 @@ on: jobs: update: - name: Update runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -20,6 +20,20 @@ jobs: with: cache-on-failure: true - run: | + # Get the list of runable examples + examples="$( + cargo run --example 2>&1 \ + | grep -E '^ ' \ + | grep -v \ + -e 'yubi_signer' \ + -e 'ws' \ + -e 'ws_auth' \ + | xargs -n1 echo + )" + + # Run the examples with the current version of Alloy + echo "$examples" | xargs -n1 cargo run --example + # Fetch the latest commit hash of the main branch from the alloy repository latest_alloy_commit=$(git ls-remote https://github.com/alloy-rs/alloy.git \ | grep refs/heads/main \ @@ -32,6 +46,6 @@ jobs: # Update to the latest commit cargo update - # Run the examples - cargo run --example 2>&1 | grep -E '^ ' | xargs -n1 cargo run --example + # Run the examples with the latest version of Alloy + echo "$examples" | xargs -n1 cargo run --example \ No newline at end of file From 7422ccf53269ec24dd2571defd8b2f8d847fbe26 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 14:44:37 +0000 Subject: [PATCH 05/10] add foundry toolchain as anvil is dependency --- .github/workflows/ci.yml | 4 +++- .github/workflows/integration.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e893ea4..71c4a24a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,10 +32,12 @@ jobs: steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable + - uses: foundry-rs/foundry-toolchain@v1 - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - run: | + - name: Run examples + run: | # Get the list of runable examples examples="$( cargo run --example 2>&1 \ diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 3ee3cd60..75a633e3 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -16,10 +16,12 @@ jobs: steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable + - uses: foundry-rs/foundry-toolchain@v1 - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - run: | + - name: Run examples + run: | # Get the list of runable examples examples="$( cargo run --example 2>&1 \ From db68a851792e4c447c798f5c80102f3860e7149d Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 14:54:43 +0000 Subject: [PATCH 06/10] mute noise or examples that are too noisy --- .github/workflows/ci.yml | 9 ++++++++- .github/workflows/integration.yml | 13 ++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71c4a24a..295be640 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,16 +39,23 @@ jobs: - name: Run examples run: | # Get the list of runable examples - examples="$( + export examples="$( cargo run --example 2>&1 \ | grep -E '^ ' \ | grep -v \ + -e 'trezor_signer' \ + -e 'ledger_signer' \ -e 'yubi_signer' \ + -e 'ipc' \ -e 'ws' \ -e 'ws_auth' \ + -e 'query_logs' \ | xargs -n1 echo )" + # Log the examples to run + echo "Running the following examples: $examples" + # Run the examples echo "$examples" | xargs -n1 cargo run --example diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 75a633e3..3af52b2d 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -23,21 +23,28 @@ jobs: - name: Run examples run: | # Get the list of runable examples - examples="$( + export examples="$( cargo run --example 2>&1 \ | grep -E '^ ' \ | grep -v \ + -e 'trezor_signer' \ + -e 'ledger_signer' \ -e 'yubi_signer' \ + -e 'ipc' \ -e 'ws' \ -e 'ws_auth' \ + -e 'query_logs' \ | xargs -n1 echo )" + # Log the examples to run + echo "Running the following examples: $examples" + # Run the examples with the current version of Alloy echo "$examples" | xargs -n1 cargo run --example - # Fetch the latest commit hash of the main branch from the alloy repository - latest_alloy_commit=$(git ls-remote https://github.com/alloy-rs/alloy.git \ + # 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) From a21727546ca5b823c3c9c6b07fc3d0c05c12c8b0 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 15:04:15 +0000 Subject: [PATCH 07/10] split into lint file --- .github/workflows/lint.yml | 39 ++++++++++++++++++++++++++ .github/workflows/{ci.yml => test.yml} | 29 +++---------------- 2 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/lint.yml rename .github/workflows/{ci.yml => test.yml} (68%) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..a0e730b7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,39 @@ +# Runs `clippy` and `cargo fmt` checks. + +name: Lint + +on: + push: + branches: [main] + pull_request: + +env: + CARGO_TERM_COLOR: always + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + clippy: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@clippy + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - run: cargo clippy --workspace --all-targets --all-features + env: + RUSTFLAGS: -Dwarnings + + fmt: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt + - run: cargo fmt --all --check diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 68% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index 295be640..6b0f28e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,6 @@ -name: CI +# Runs build checks and examples. + +name: Test on: push: @@ -57,27 +59,4 @@ jobs: echo "Running the following examples: $examples" # Run the examples - echo "$examples" | xargs -n1 cargo run --example - - clippy: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@clippy - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - run: cargo clippy --workspace --all-targets --all-features - env: - RUSTFLAGS: -Dwarnings - - fmt: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@nightly - with: - components: rustfmt - - run: cargo fmt --all --check + echo "$examples" | xargs -n1 cargo run --example From f078b23da935879b4efd1c51982a23b7b9cc7739 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 15:23:15 +0000 Subject: [PATCH 08/10] re-enable noisy examples, pipe stdout to null but keep stderr --- .github/workflows/integration.yml | 11 +++++++---- .github/workflows/test.yml | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 3af52b2d..36466042 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -33,15 +33,16 @@ jobs: -e 'ipc' \ -e 'ws' \ -e 'ws_auth' \ - -e 'query_logs' \ | xargs -n1 echo )" # Log the examples to run - echo "Running the following examples: $examples" + echo -e "Running the following examples:\n$examples" # Run the examples with the current version of Alloy - echo "$examples" | xargs -n1 cargo run --example + for example in $examples; do + cargo run --example $example --quiet 1>/dev/null + done # 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 \ @@ -56,5 +57,7 @@ jobs: cargo update # Run the examples with the latest version of Alloy - echo "$examples" | xargs -n1 cargo run --example + for example in $examples; do + cargo run --example $example --quiet 1>/dev/null + done \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b0f28e8..7824f90c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,12 +51,13 @@ jobs: -e 'ipc' \ -e 'ws' \ -e 'ws_auth' \ - -e 'query_logs' \ | xargs -n1 echo )" # Log the examples to run - echo "Running the following examples: $examples" + echo -e "Running the following examples:\n$examples" # Run the examples - echo "$examples" | xargs -n1 cargo run --example + for example in $examples; do + cargo run --example $example --quiet 1>/dev/null + done From a64c91abd19581cefaeb4a5c030dfe0522d9808a Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 15:29:41 +0000 Subject: [PATCH 09/10] reconstruct structured logs --- .github/workflows/integration.yml | 21 ++++++++++++++++++--- .github/workflows/test.yml | 12 +++++++++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 36466042..c203f56c 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -36,12 +36,18 @@ jobs: | xargs -n1 echo )" - # Log the examples to run - echo -e "Running the following examples:\n$examples" - # Run the examples with the current version of Alloy for example in $examples; do + echo "Running: $example ..." + 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 # Fetch the latest commit hash of the main branch from the Alloy repository @@ -58,6 +64,15 @@ jobs: # Run the examples with the latest version of Alloy for example in $examples; do + echo "Running: $example ..." + 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 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7824f90c..fb17d28a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,10 +54,16 @@ jobs: | xargs -n1 echo )" - # Log the examples to run - echo -e "Running the following examples:\n$examples" - # Run the examples for example in $examples; do + echo "Running: $example ..." + 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 From d9ff19df8c0084cc9d60bf249fae6adcc78949f6 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 26 Mar 2024 15:40:41 +0000 Subject: [PATCH 10/10] clean up --- .github/workflows/integration.yml | 4 ---- .github/workflows/test.yml | 2 -- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index c203f56c..542d9e88 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -38,8 +38,6 @@ jobs: # Run the examples with the current version of Alloy for example in $examples; do - echo "Running: $example ..." - cargo run --example $example --quiet 1>/dev/null if [ $? -ne 0 ]; then @@ -64,8 +62,6 @@ jobs: # Run the examples with the latest version of Alloy for example in $examples; do - echo "Running: $example ..." - cargo run --example $example --quiet 1>/dev/null if [ $? -ne 0 ]; then diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fb17d28a..85b47f8f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,8 +56,6 @@ jobs: # Run the examples for example in $examples; do - echo "Running: $example ..." - cargo run --example $example --quiet 1>/dev/null if [ $? -ne 0 ]; then