177 lines
6.2 KiB
YAML
177 lines
6.2 KiB
YAML
on: [push, pull_request]
|
|
|
|
name: CI
|
|
|
|
jobs:
|
|
|
|
build-test:
|
|
name: Build and test
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust:
|
|
- 1.51.0 # STABLE
|
|
- 1.46.0 # MSRV
|
|
features:
|
|
- default
|
|
- minimal
|
|
- all-keys
|
|
- minimal,esplora
|
|
- key-value-db
|
|
- electrum
|
|
- compact_filters
|
|
- esplora,key-value-db,electrum
|
|
- compiler
|
|
- rpc
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: Generate cache key
|
|
run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key
|
|
- name: cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
|
- name: Set default toolchain
|
|
run: rustup default ${{ matrix.rust }}
|
|
- name: Set profile
|
|
run: rustup set profile minimal
|
|
- name: Add clippy
|
|
run: rustup component add clippy
|
|
- name: Update toolchain
|
|
run: rustup update
|
|
- name: Build
|
|
run: cargo build --features ${{ matrix.features }} --no-default-features
|
|
- name: Clippy
|
|
run: cargo clippy --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings
|
|
- name: Test
|
|
run: cargo test --features ${{ matrix.features }} --no-default-features
|
|
|
|
test-readme-examples:
|
|
name: Test README.md examples
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-test-md-docs-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
|
- name: Set default toolchain
|
|
run: rustup default nightly
|
|
- name: Set profile
|
|
run: rustup set profile minimal
|
|
- name: Update toolchain
|
|
run: rustup update
|
|
- name: Test
|
|
run: cargo test --features test-md-docs --no-default-features -- doctest::ReadmeDoctests
|
|
|
|
test-blockchains:
|
|
name: Test ${{ matrix.blockchain.name }}
|
|
runs-on: ubuntu-16.04
|
|
strategy:
|
|
matrix:
|
|
blockchain:
|
|
- name: electrum
|
|
container: bitcoindevkit/electrs:0.4.0
|
|
start: /root/electrs --network regtest --cookie-file $GITHUB_WORKSPACE/.bitcoin/regtest/.cookie --jsonrpc-import
|
|
- name: esplora
|
|
container: bitcoindevkit/esplora:0.4.0
|
|
start: /root/electrs --network regtest -vvv --daemon-dir $GITHUB_WORKSPACE/.bitcoin --jsonrpc-import --electrum-rpc-addr=0.0.0.0:60401 --http-addr 0.0.0.0:3002
|
|
- name: rpc
|
|
container: bitcoindevkit/electrs:0.4.0
|
|
start: /root/electrs --network regtest --cookie-file $GITHUB_WORKSPACE/.bitcoin/regtest/.cookie --jsonrpc-import
|
|
container: ${{ matrix.blockchain.container }}
|
|
env:
|
|
BDK_RPC_AUTH: COOKIEFILE
|
|
BDK_RPC_COOKIEFILE: ${{ github.workspace }}/.bitcoin/regtest/.cookie
|
|
BDK_RPC_URL: 127.0.0.1:18443
|
|
BDK_RPC_WALLET: bdk-test
|
|
BDK_ELECTRUM_URL: tcp://127.0.0.1:60401
|
|
BDK_ESPLORA_URL: http://127.0.0.1:3002
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
|
- name: get pkg-config # running esplora tests seems to need this
|
|
run: apt update && apt install -y --fix-missing pkg-config libssl-dev
|
|
- name: Install rustup
|
|
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
|
|
- name: Set default toolchain
|
|
run: $HOME/.cargo/bin/rustup default 1.51.0 # STABLE
|
|
- name: Set profile
|
|
run: $HOME/.cargo/bin/rustup set profile minimal
|
|
- name: Update toolchain
|
|
run: $HOME/.cargo/bin/rustup update
|
|
- name: Start core
|
|
run: ./ci/start-core.sh
|
|
- name: start ${{ matrix.blockchain.name }}
|
|
run: nohup ${{ matrix.blockchain.start }} & sleep 5
|
|
- name: Test
|
|
run: $HOME/.cargo/bin/cargo test --features test-${{ matrix.blockchain.name }},test-blockchains --no-default-features ${{ matrix.blockchain.name }}::bdk_blockchain_tests
|
|
|
|
check-wasm:
|
|
name: Check WASM
|
|
runs-on: ubuntu-16.04
|
|
env:
|
|
CC: clang-10
|
|
CFLAGS: -I/usr/include
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
|
# Install a recent version of clang that supports wasm32
|
|
- run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1
|
|
- run: sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" || exit 1
|
|
- run: sudo apt-get update || exit 1
|
|
- run: sudo apt-get install -y libclang-common-10-dev clang-10 libc6-dev-i386 || exit 1
|
|
- name: Set default toolchain
|
|
run: rustup default 1.51.0 # STABLE
|
|
- name: Set profile
|
|
run: rustup set profile minimal
|
|
- name: Add target wasm32
|
|
run: rustup target add wasm32-unknown-unknown
|
|
- name: Update toolchain
|
|
run: rustup update
|
|
- name: Check
|
|
run: cargo check --target wasm32-unknown-unknown --features esplora --no-default-features
|
|
|
|
fmt:
|
|
name: Rust fmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Set default toolchain
|
|
run: rustup default nightly
|
|
- name: Set profile
|
|
run: rustup set profile minimal
|
|
- name: Add rustfmt
|
|
run: rustup component add rustfmt
|
|
- name: Update toolchain
|
|
run: rustup update
|
|
- name: Check fmt
|
|
run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
|