From 98803b25734428c1a20c07c890ab90058e401f98 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Thu, 8 Oct 2020 16:35:00 -0700 Subject: [PATCH] [ci] Use bitcoindevkit/electrs base image for electrum tests --- .github/workflows/cont_integration.yml | 8 +++++-- ci/start-core.sh | 29 ++++++++------------------ 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index e8c7f8d4..2efae92a 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -78,8 +78,12 @@ jobs: test-electrum: name: Test Electrum runs-on: ubuntu-16.04 + container: bitcoindevkit/electrs env: - MAGICAL_RPC_COOKIEFILE: /home/runner/.bitcoin/regtest/.cookie + MAGICAL_RPC_AUTH: USER_PASS + MAGICAL_RPC_USER: admin + MAGICAL_RPC_PASS: passw + MAGICAL_RPC_URL: 127.0.0.1:18443 MAGICAL_ELECTRUM_URL: tcp://127.0.0.1:60401 steps: - name: checkout @@ -99,7 +103,7 @@ jobs: toolchain: stable override: true - name: start core - run: ./ci/start-core.sh || exit 1 + run: ./ci/start-core.sh - name: test uses: actions-rs/cargo@v1 with: diff --git a/ci/start-core.sh b/ci/start-core.sh index 45773268..8384529a 100755 --- a/ci/start-core.sh +++ b/ci/start-core.sh @@ -1,28 +1,17 @@ #!/usr/bin/env sh -set -e +echo "Starting bitcoin node." +/root/bitcoind -regtest -server -daemon -fallbackfee=0.0002 -rpcuser=admin -rpcpassword=passw -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -BITCOIN_VERSION=0.20.1 - -wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1 -sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" || exit 1 -sudo apt-get update || exit 1 -sudo apt-get install -y libllvm10 clang-10 libclang-common-10-dev || exit 1 - -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 +echo "Waiting for bitcoin node." +until /root/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=passw getblockchaininfo; do sleep 1 done -ADDR=$(bitcoin-cli -regtest getnewaddress) -bitcoin-cli -regtest generatetoaddress 150 $ADDR +echo "Generating 150 bitcoin blocks." +ADDR=$(/root/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=passw getnewaddress) +/root/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=passw generatetoaddress 150 $ADDR -nohup electrs --network regtest --jsonrpc-import --cookie-file $HOME/.bitcoin/regtest/.cookie & +echo "Starting electrs node." +nohup /root/electrs --network regtest --jsonrpc-import & sleep 5