Skip to content

Commit

Permalink
[ci] Use bitcoindevkit/electrs base image for electrum tests
Browse files Browse the repository at this point in the history
  • Loading branch information
notmandatory committed Oct 10, 2020
1 parent aea9abf commit 98803b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
29 changes: 9 additions & 20 deletions ci/start-core.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 98803b2

Please sign in to comment.