Skip to content
Merged

ci #13

Show file tree
Hide file tree
Changes from 2 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
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: "CI"

on:
pull_request:
merge_group:
push:
branches: [main]

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
cargo-build:
name: Cargo Build
runs-on: ubuntu-latest

steps:
- name: Fetch Repository
uses: actions/checkout@v5

- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: cargo build
run: cargo b --workspace --all-targets --all-features

cargo-fmt:
name: Cargo fmt
runs-on: ubuntu-latest

steps:
- name: Fetch Repository
uses: actions/checkout@v5

- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
toolchain: nightly

- name: Rustfmt Check
run: cargo fmt --all --check

cargo-clippy:
name: Cargo clippy
runs-on: ubuntu-latest

steps:
- name: Fetch Repository
uses: actions/checkout@v5

- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy

- name: Clippy Check
run: cargo clippy --workspace --all-targets --all-features -- -D warnings

typos-cli:
name: typos
runs-on: ubuntu-latest

steps:
- name: Fetch Repository
uses: actions/checkout@v5

- name: Install Typos
uses: taiki-e/install-action@v2
with:
tool: typos-cli

- name: run typos
run: typos
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: tests

on:
pull_request:
merge_group:
push:
branches: [main]

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
cargo-next-test:
name: Cargo test
runs-on: ubuntu-latest

steps:
- name: Fetch Repository
uses: actions/checkout@v5

- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest

- name: Cargo test
run: cargo nextest run --workspace --all-targets --all-features --no-tests=pass
7 changes: 2 additions & 5 deletions examples/historical_scanning/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use std::{sync::Arc, time::Duration};

use alloy::providers::{ProviderBuilder};
use alloy::rpc::types::Log;
use alloy::sol;
use alloy::sol_types::SolEvent;
use alloy::{providers::ProviderBuilder, rpc::types::Log, sol, sol_types::SolEvent};
use alloy_node_bindings::Anvil;
use async_trait::async_trait;
use event_scanner::{CallbackConfig, EventCallback, EventFilter, ScannerBuilder};
Expand Down Expand Up @@ -65,7 +62,7 @@ async fn main() -> anyhow::Result<()> {
callback: Arc::new(CounterCallback),
};

counter_contract.increase().send().await?;
let _ = counter_contract.increase().send().await?.get_receipt().await?;

let mut scanner = ScannerBuilder::new(anvil.ws_endpoint_url())
.add_event_filter(increase_filter)
Expand Down
5 changes: 1 addition & 4 deletions examples/simple_counter/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use std::{sync::Arc, time::Duration};

use alloy::providers::ProviderBuilder;
use alloy::rpc::types::Log;
use alloy::sol;
use alloy::sol_types::SolEvent;
use alloy::{providers::ProviderBuilder, rpc::types::Log, sol, sol_types::SolEvent};
use alloy_node_bindings::Anvil;
use async_trait::async_trait;
use event_scanner::{CallbackConfig, EventCallback, EventFilter, ScannerBuilder};
Expand Down
10 changes: 6 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ pub mod callback;
pub mod scanner;
pub mod types;

pub use crate::builder::ScannerBuilder;
pub use crate::callback::EventCallback;
pub use crate::scanner::Scanner;
pub use crate::types::{CallbackConfig, EventFilter};
pub use crate::{
Copy link
Collaborator

@0xNeshi 0xNeshi Sep 11, 2025

Choose a reason for hiding this comment

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

I use the rust-analyzer extension, my IDE is configured to auto-format when saving the file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i have that as well but for some reason i can't get it to format using the rules in the rustfmt.toml file because it requires the nightly version of rustfmt, so my ide only formats based on naive fmt rules instead of the project ones.

Copy link
Collaborator

Choose a reason for hiding this comment

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

weird

builder::ScannerBuilder,
callback::EventCallback,
scanner::Scanner,
types::{CallbackConfig, EventFilter},
};