[tests] Run Bitcoin Core and Electrs on Travis

This commit is contained in:
Alekos Filini 2020-08-10 23:00:32 +02:00
parent 53b5f23fb2
commit 8f8c393f6f
No known key found for this signature in database
GPG Key ID: 5E8AFC3034FDFA4F
2 changed files with 31 additions and 9 deletions

View File

@ -4,6 +4,8 @@ rust:
env: env:
global: global:
- MAGICAL_RPC_COOKIEFILE=/home/travis/.bitcoin/regtest/.cookie
- MAGICAL_ELECTRUM_URL=tcp://127.0.0.1:60401
jobs: jobs:
- TARGET=x86_64-unknown-linux-gnu CHECK_FMT=1 - TARGET=x86_64-unknown-linux-gnu CHECK_FMT=1
- TARGET=x86_64-unknown-linux-gnu RUN_TESTS=1 - TARGET=x86_64-unknown-linux-gnu RUN_TESTS=1
@ -13,8 +15,8 @@ env:
- TARGET=x86_64-unknown-linux-gnu FEATURES=electrum NO_DEFAULT_FEATURES=1 - TARGET=x86_64-unknown-linux-gnu FEATURES=electrum NO_DEFAULT_FEATURES=1
- TARGET=x86_64-unknown-linux-gnu FEATURES=cli-utils,esplora NO_DEFAULT_FEATURES=1 - TARGET=x86_64-unknown-linux-gnu FEATURES=cli-utils,esplora NO_DEFAULT_FEATURES=1
- TARGET=x86_64-unknown-linux-gnu FEATURES=compiler NO_DEFAULT_FEATURES=1 RUN_TESTS=1 # Test the `miniscriptc` example - TARGET=x86_64-unknown-linux-gnu FEATURES=compiler NO_DEFAULT_FEATURES=1 RUN_TESTS=1 # Test the `miniscriptc` example
- TARGET=x86_64-unknown-linux-gnu FEATURES=test-electrum NO_DEFAULT_FEATURES=1 RUN_TESTS=1 RUN_CORE=1
- TARGET=wasm32-unknown-unknown FEATURES=cli-utils,esplora NO_DEFAULT_FEATURES=1 - TARGET=wasm32-unknown-unknown FEATURES=cli-utils,esplora NO_DEFAULT_FEATURES=1
before_script: before_script:
- | - |
if [[ "$TARGET" = "wasm32-unknown-unknown" ]]; then if [[ "$TARGET" = "wasm32-unknown-unknown" ]]; then
@ -42,15 +44,11 @@ script:
else else
CMD=build CMD=build
fi fi
- |
if [[ $RUN_CORE -eq 1 ]]; then
./ci/start-core.sh || exit 1
fi
- cargo $CMD --verbose --target=$TARGET --features=$FEATURES $( (( NO_DEFAULT_FEATURES == 1 )) && printf %s '--no-default-features' ) - cargo $CMD --verbose --target=$TARGET --features=$FEATURES $( (( NO_DEFAULT_FEATURES == 1 )) && printf %s '--no-default-features' )
# - cargo fmt -- --check --verbose
# - cargo test --verbose --all
# - cargo build --verbose --all
# - cargo build --verbose --no-default-features --features=minimal
# - cargo build --verbose --no-default-features --features=minimal,esplora
# - cargo build --verbose --no-default-features --features=key-value-db
# - cargo build --verbose --no-default-features --features=electrum
# - CC="clang-10" CFLAGS="-I/usr/include" cargo build --verbose --no-default-features --features=cli-utils,esplora --target=wasm32-unknown-unknown
notifications: notifications:
email: false email: false

24
ci/start-core.sh Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env sh
set -e
BITCOIN_VERSION=0.20.1
# This should be cached by Travis
cargo install --git https://github.com/romanz/electrs --bin electrs
curl -O -L https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/bitcoin-$BITCOIN_VERSION-x86_64-linux-gnu.tar.gz
tar xf bitcoin-$BITCOIN_VERSION-x86_64-linux-gnu.tar.gz
export PATH=$PATH:./bitcoin-$BITCOIN_VERSION/bin
bitcoind -regtest=1 -daemon=1 -fallbackfee=0.0002
until bitcoin-cli -regtest getblockchaininfo; do
sleep 1
done
ADDR=$(bitcoin-cli -regtest getnewaddress)
bitcoin-cli -regtest generatetoaddress 150 $ADDR
nohup electrs --network regtest --jsonrpc-import --cookie-file /home/travis/.bitcoin/regtest/.cookie &
sleep 5