travis: Add initial travis config

This commit is contained in:
Christian Decker
2019-11-26 12:07:46 +01:00
parent 65304d4baf
commit 31a5ce8700
2 changed files with 68 additions and 0 deletions

16
.travis.yml Normal file
View File

@@ -0,0 +1,16 @@
language: c
dist: bionic
notifications:
email: false
cache:
directories:
- dependencies
before_install:
sudo apt-get install -y libsqlite3-dev gcc-4.8 gettext python python3 python3-mako net-tools zlib1g-dev libsodium-dev
script:
.travis/build.sh

52
.travis/build.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/bash -x
set -e
CWD=$(pwd)
export SLOW_MACHINE=1
export PATH=$CWD/dependencies/bin:$CWD/dependencies/usr/local/bin/:/tmp/lightning/lightningd/:"$HOME"/.local/bin:"$PATH"
export PYTEST_PAR=10
export TEST_DEBUG=1
export LIGHTNING_VERSION=${LIGHTNING_VERSION:-master}
export PYTHONPATH=/tmp/lightning/contrib/pyln-client:/tmp/lightning/contrib/pyln-testing:/tmp/lightning/contrib/pylightning:$$PYTHONPATH
mkdir -p dependencies/bin
# Download bitcoind and bitcoin-cli
if [ ! -f dependencies/bin/bitcoind ]; then
wget https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-x86_64-linux-gnu.tar.gz
tar -xzf bitcoin-0.17.1-x86_64-linux-gnu.tar.gz
mv bitcoin-0.17.1/bin/* dependencies/bin
rm -rf bitcoin-0.17.1-x86_64-linux-gnu.tar.gz bitcoin-0.17.1
fi
pyenv global 3.7.1
pip3 install --upgrade pip
pip3 install --user --quiet \
pyln-testing \
mako==1.0.14 \
psycopg2-binary==2.8.3 \
pytest-timeout==1.3.3 \
pytest-xdist==1.30.0
# Install the pyln-client and testing library matching c-lightning `master`
PY3=$(which python3)
git clone --recursive https://github.com/ElementsProject/lightning.git /tmp/lightning
(cd /tmp/lightning && git checkout "$LIGHTNING_VERSION")
(cd /tmp/lightning/contrib/pyln-client && $PY3 setup.py install)
(cd /tmp/lightning/contrib/pyln-testing && $PY3 setup.py install)
# Compiling lightningd can be noisy and time-consuming, cache the binaries
if [ ! -f "$CWD/dependencies/usr/local/bin/lightningd" ]; then
(
cd /tmp/lightning && \
./configure --enable-developer --disable-valgrind --enable-experimental-features && \
make -j 8 DESTDIR=dependencies/
)
fi
# Collect libraries that the plugins need and install them
find . -name requirements.txt -exec pip3 install --user -r {} \;
pytest -vvv --timeout=550 --timeout_method=thread -p no:logging -n 10