Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
187 changes: 187 additions & 0 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
on: [push, pull_request]

name: CI

jobs:
# formatting
fmt:
name: Rust fmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

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

# Clippy lints
clippy:
name: Clippy (${{ matrix.rust }}, ${{ matrix.features }})
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, beta]
features:
- --features default
- --no-default-features
- --all-features
steps:
- uses: actions/checkout@v4

- name: Install Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy

- name: Generate cache key
run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-index-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-build-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.lock') }}

- name: Run Clippy
run: cargo clippy ${{ matrix.features }} --all-targets -- -D warnings

# Build and test
test:
name: Test (${{ matrix.os }}, ${{ matrix.rust }}, ${{ matrix.features }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable, beta, nightly]
features:
- --features default
- --no-default-features
- --all-features
exclude:
- os: windows-latest
rust: beta
- os: windows-latest
features: --no-default-features
- os: macos-latest
rust: beta
- os: macos-latest
features: --no-default-features
- os: windows-latest
rust: nightly
features: --no-default-features
- os: macos-latest
rust: nightly
features: --no-default-features
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Generate cache key
shell: bash
run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-index-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-build-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.lock') }}

- name: Build
run: cargo build ${{ matrix.features }} --verbose

- name: Run unit tests
run: cargo test ${{ matrix.features }} --lib --verbose

- name: Run doc tests
run: cargo test ${{ matrix.features }} --doc --verbose
continue-on-error: ${{ matrix.rust == 'nightly' }}


# Integration tests (requires Bitcoin node)
integration-test:
name: Integration Tests (${{ matrix.features }})
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
strategy:
matrix:
features:
- --features default
- --all-features
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install Bitcoin Core 27.0
run: |
wget https://bitcoincore.org/bin/bitcoin-core-30.0/bitcoin-30.0-x86_64-linux-gnu.tar.gz
tar xzf bitcoin-30.0-x86_64-linux-gnu.tar.gz
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-30.0/bin/*
- name: Start Bitcoin Core (regtest)
run: |
mkdir -p ~/.bitcoin
bitcoind -regtest -daemon -rpcuser=test -rpcpassword=test -rpcport=18443
sleep 5
- name: Run integration tests
run: cargo test ${{ matrix.features }} --test integration -- --ignored --test-threads=1
env:
BITCOIN_RPC_URL: http://localhost:18443
BITCOIN_RPC_USER: bitcoin
BITCOIN_RPC_PASS: bitcoin

- name: Stop Bitcoin Core
if: always()
run: bitcoin-cli -regtest -rpcuser=bitcoin -rpcpassword=bitcoin stop || true

# MSRV
msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust 1.70.0
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.70.0

- name: Check MSRV
run: cargo check --all-features
2 changes: 1 addition & 1 deletion Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[package]
name = "bdk-rpc-client"
name = "bdk_rpc_client"
version = "0.1.0"
edition = "2024"

[dependencies]
corepc-types = { version = "0.10.1", features = ["default"]}
jsonrpc = { version = "0.18.0", features = ["simple_http", "simple_tcp", "minreq_http", "simple_uds", "proxy"] }

[features]
default = [ "v30" ]
v30 = [ ]