Skip to content

Commit

Permalink
Merge pull request #9 from halo3mic/dev
Browse files Browse the repository at this point in the history
Logging; Redis; CI
  • Loading branch information
halo3mic authored May 3, 2024
2 parents 33d9c10 + 564481c commit 1387d5b
Show file tree
Hide file tree
Showing 19 changed files with 616 additions and 83 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Cargo Build & Test

on:
push:
pull_request:

env:
CARGO_TERM_COLOR: always
ETH_RPC_URL: https://eth.drpc.org

jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v3
- name: foundryup
run: |
curl -L https://foundry.paradigm.xyz | bash
/home/runner/.config/.foundry/bin/foundryup
- name: Update
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: |
export PATH="$PATH:/home/runner/.config/.foundry/bin"
cargo test --verbose -- --nocapture
- name: Run Clippy
run: cargo clippy
128 changes: 128 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ jsonrpc = { version = "0.18.0", optional = true }
axum = { version = "0.6.20", features = ["headers"] }
serde = "1.0.188"
dotenv = "0.15.0"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
redis = "0.25.3"

[dependencies.uuid]
version = "1.8.0"
features = [
"v4",
"fast-rng",
]


[dev-dependencies]
reqwest = { version = "0.12.4", features = ["json"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/eth_token_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct TokenInfo {
#[tokio::main]
async fn main() -> Result<()> {
let ethereum_tokens = coingecko_all_tokens("ethereum".to_string()).await?;
let rpc_endpoint = env_var("RPC_URL")?;
let rpc_endpoint = env_var("ETH_RPC_URL")?;
let anvil = spawn_anvil(Some(&rpc_endpoint));

for (symbol, token) in ethereum_tokens {
Expand Down
21 changes: 20 additions & 1 deletion src/bin/serve/.env.sample
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Server configuration
SERVER_PORT=8080
SERVER_HOST=localhost

# Logging to stdout
LOGGING_ENABLED=1

# Timeout for the RPC requests in milliseconds
TIMEOUT_MS=

# RPCs with debug api and struct trace enabled (can be omitted)
ETHEREUM_RPC=
ARBITRUM_RPC=
Expand All @@ -12,4 +19,16 @@ AVALANCHE_RPC=
ETHEREUM_FORK_RPC=https://eth.llamarpc.com
ARBITRUM_FORK_RPC=https://arb1.arbitrum.io/rpc
OPTIMISM_FORK_RPC=https://optimism.llamarpc.com
AVALANCHE_FORK_RPC=https://avalanche.public-rpc.com
AVALANCHE_FORK_RPC=https://avalanche.public-rpc.com

# Redis (optional)
REDIS_ENABLED=1
REDIS_HOST=localhost
REDIS_PORT=9090
REDIS_PASSWORD=
REDIS_IS_TLS=1

# Anvil
ANVIL_TIMEOUT_MS=
ANVIL_MEMORY_LIMIT=
ANVIL_CPU_PER_SEC=
Loading

0 comments on commit 1387d5b

Please sign in to comment.