mirror of
https://github.com/cryptoadvance/specter-desktop.git
synced 2026-08-13 12:33:29 +02:00
commit
09280da5b2
5 changed files with 117 additions and 3 deletions
46
.travis.yml
Normal file
46
.travis.yml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
language: python
|
||||
os: linux
|
||||
dist: xenial
|
||||
cache:
|
||||
pip: true
|
||||
ccache: true
|
||||
directories:
|
||||
- tests/bitcoin
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:bitcoin/bitcoin'
|
||||
packages:
|
||||
- libdb4.8-dev
|
||||
- libdb4.8++-dev
|
||||
- build-essential
|
||||
- curl
|
||||
- git
|
||||
- libsdl2-dev
|
||||
- libsdl2-image-dev
|
||||
- gcc-arm-none-eabi
|
||||
- libnewlib-arm-none-eabi
|
||||
- libudev-dev
|
||||
- libtool
|
||||
- autotools-dev
|
||||
- automake
|
||||
- pkg-config
|
||||
- bsdmainutils
|
||||
- libssl-dev
|
||||
- libevent-dev
|
||||
- libboost-system-dev
|
||||
- libboost-filesystem-dev
|
||||
- libboost-chrono-dev
|
||||
- libboost-test-dev
|
||||
- libboost-thread-dev
|
||||
- libusb-1.0-0-dev
|
||||
- protobuf-compiler
|
||||
- cython3
|
||||
- ccache
|
||||
|
||||
before_install:
|
||||
- set -o errexit; source ./tests/install_bitcoind.sh
|
||||
script:
|
||||
- pip install -e .
|
||||
- pytest
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
# Specter Desktop
|
||||
|
||||
[](https://travis-ci.org/cryptoadvance/specter-desktop)
|
||||
|
||||
## DISCLAIMER
|
||||
|
||||
This software is **WORK IN PROGRESS and NOT READY TO USE YET**. Currently tested only in Chrome, so in other browsers it may look weird.
|
||||
|
|
|
|||
2
pytest.ini
Normal file
2
pytest.ini
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[pytest]
|
||||
norecursedirs = tests/bitcoin
|
||||
|
|
@ -54,10 +54,14 @@ def start_bitcoind(bitcoind_path, cleanup_at_exit=True, rpc_port=18543):
|
|||
# This is not needed
|
||||
bitcoind_path += " -datadir={} ".format(datadir)
|
||||
print(" --> About to execute: {}".format(bitcoind_path))
|
||||
bitcoind_proc = subprocess.Popen(bitcoind_path, shell=True)
|
||||
# exec will prevent creating a child-process and will make bitcoind_proc.terminate() work as expected
|
||||
bitcoind_proc = subprocess.Popen("exec " + bitcoind_path, shell=True)
|
||||
print(" --> Running bitcoind-process with pid {}".format(bitcoind_proc.pid))
|
||||
def cleanup_bitcoind():
|
||||
bitcoind_proc.kill()
|
||||
bitcoind_proc.kill() # much faster then terminate() and speed is key here over being nice
|
||||
print(" --> Killed bitcoind-process with pid {}".format(bitcoind_proc.pid))
|
||||
shutil.rmtree(datadir)
|
||||
print(" --> removed temp-dir")
|
||||
if cleanup_at_exit:
|
||||
atexit.register(cleanup_bitcoind)
|
||||
ip_address = '127.0.0.1'
|
||||
|
|
@ -122,7 +126,10 @@ def bitcoin_regtest(docker):
|
|||
if docker:
|
||||
bitcoind_path = 'docker'
|
||||
else:
|
||||
bitcoind_path = 'bitcoind ' # Let's take the one on the path for now
|
||||
if os.path.isfile('tests/bitcoin/src/bitcoind'):
|
||||
bitcoind_path = 'tests/bitcoin/src/bitcoind ' # always prefer the self-compiled bitcoind if existing
|
||||
else:
|
||||
bitcoind_path = 'bitcoind ' # Alternatively take the one on the path for now
|
||||
btc_conn['rpc'], btc_conn['rpc_username'], btc_conn['rpc_password'], btc_conn['rpc_host'], btc_conn['rpc_port'] = start_bitcoind(bitcoind_path)
|
||||
return btc_conn
|
||||
|
||||
|
|
|
|||
57
tests/install_bitcoind.sh
Executable file
57
tests/install_bitcoind.sh
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
echo " --> install_bitcoind.sh Start $(date)"
|
||||
START=$(date +%s.%N)
|
||||
# Clone bitcoind if it doesn't exist, or update it if it does
|
||||
# (copied from HWI)
|
||||
cd tests
|
||||
bitcoind_setup_needed=false
|
||||
if [ ! -d "./bitcoin/.git" ]; then
|
||||
echo " --> cloning bitcoin"
|
||||
git clone https://github.com/bitcoin/bitcoin.git
|
||||
cd bitcoin
|
||||
bitcoind_setup_needed=true
|
||||
else
|
||||
cd bitcoin
|
||||
echo " --> fetching bitcoin"
|
||||
git fetch
|
||||
fi
|
||||
|
||||
# Determine if we need to pull. From https://stackoverflow.com/a/3278427
|
||||
UPSTREAM=${1:-'@{u}'}
|
||||
LOCAL=$(git rev-parse @)
|
||||
if [ -f ../bitcoin_pin ]; then
|
||||
PINNED=$(cat ../bitcoin_pin)
|
||||
fi
|
||||
if [ -z $PINNED ]; then
|
||||
REMOTE=$(git rev-parse "$UPSTREAM")
|
||||
BASE=$(git merge-base @ "$UPSTREAM")
|
||||
if [ $LOCAL = $REMOTE ]; then
|
||||
echo "Up-to-date"
|
||||
elif [ $LOCAL = $BASE ]; then
|
||||
git pull
|
||||
bitcoind_setup_needed=true
|
||||
fi
|
||||
else
|
||||
if [ $LOCAL = $PINNED ]; then
|
||||
echo " --> Pinned: $PINNED! Checkout not needed!"
|
||||
else
|
||||
echo " --> Pinned: $PINNED! Checkout needed!"
|
||||
git pull
|
||||
git checkout $PINNED
|
||||
bitcoind_setup_needed=true
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Build bitcoind. This is super slow, but it is cached so it runs fairly quickly.
|
||||
if [ "$bitcoind_setup_needed" = "true" ] ; then
|
||||
echo " --> Setup needed. Starting autogen"
|
||||
./autogen.sh
|
||||
echo " --> Starting configure"
|
||||
./configure --with-miniupnpc=no --without-gui --disable-zmq --disable-tests --disable-bench --with-libs=no --with-utils=no
|
||||
fi
|
||||
make -j$(nproc) src/bitcoind
|
||||
cd ../.. #travis is sourcing this script
|
||||
echo " --> Finished build bitcoind"
|
||||
END=$(date +%s.%N)
|
||||
DIFF=$(echo "$END - $START" | bc)
|
||||
echo " --> install_bitcoind.sh End $(date) took $DIFF"
|
||||
Loading…
Add table
Add a link
Reference in a new issue