diff --git a/.travis.yml b/.travis.yml index 309c05bc..84a0a8bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,41 +1,21 @@ language: cpp -os: - - linux - -cache: - apt: true - ccache: true - directories: - - $HOME/boost - -env: - global: - - BOOST_URL=http://ftp.osuosl.org/pub/blfs/conglomeration/boost/boost_1_63_0.tar.bz2 +matrix: + include: + - os: linux + dist: trusty + sudo: required + services: + - docker + - os: osx compiler: - gcc - - clang - -addons: - apt: - packages: - - qtbase5-dev before_install: - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install qt5; fi - -before_script: - - if [ ! -f $HOME/boost/.built ]; then curl -fOL $BOOST_URL; fi - - if [ ! -f $HOME/boost/.built ]; then tar xjf boost_1_63_0.tar.bz2; fi - - if [ ! -f $HOME/boost/.built ]; then cd boost_1_63_0; fi - - if [ ! -f $HOME/boost/.built ]; then rm -f project-config.jam; fi - - if [ ! -f $HOME/boost/.built ]; then ./bootstrap.sh; fi - - if [ ! -f $HOME/boost/.built ]; then ./b2 --with-atomic --with-chrono --with-filesystem --with-log --with-program_options --with-regex --with-system --with-thread --no-samples --no-tests link=static threading=multi --prefix=$HOME/boost/$TRAVIS_OS_NAME/$CC install; fi - - if [ ! -f $HOME/boost/.built ]; then touch $HOME/boost/.built; fi - - cd $TRAVIS_BUILD_DIR - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake -DBOOST_ROOT=$HOME/boost/$TRAVIS_OS_NAME/$CC -DQt5_DIR=/usr/local/opt/qt/lib/cmake/Qt5 -DRAIBLOCKS_GUI=ON .; else cmake -DBOOST_ROOT=$HOME/boost/$TRAVIS_OS_NAME/$CC -DRAIBLOCKS_GUI=ON .; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update && brew install qt5 && brew upgrade boost; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then docker pull lukealonso/raiblocks-ci:latest; fi script: - - make -j3 rai_node rai_wallet + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then ci/build-travis.sh "/usr/local/opt/qt5/lib/cmake/Qt5"; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then docker run -v $TRAVIS_BUILD_DIR:/workspace lukealonso/raiblocks-ci:latest /bin/bash -c "cd /workspace && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5"; fi diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 59db18bf..00000000 --- a/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -FROM debian:8.9 -MAINTAINER Zjeraar - -ENV BOOST_BASENAME=boost_1_66_0 \ - BOOST_ROOT=/tmp/boost \ - BOOST_URL=http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz/download - -RUN \ - apt-get update && \ - apt-get install -yq apt-utils && \ - apt-get install -yq locales && \ - apt-get install -yq build-essential && \ - apt-get install -yq wget && \ - apt-get install -yq git && \ - apt-get install -yq cmake && \ - apt-get install -yq g++ && \ - apt-get install -yq curl && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ - dpkg-reconfigure locales && \ - echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && \ - locale-gen - -WORKDIR /tmp - -RUN \ - wget -O ${BOOST_BASENAME}.tar.gz ${BOOST_URL} && \ - tar xzvf ${BOOST_BASENAME}.tar.gz && \ - cd ${BOOST_BASENAME} && \ - ./bootstrap.sh && \ - ./b2 --prefix=${BOOST_ROOT} link=static install && \ - rm -rf ${BOOST_BASENAME} && \ - rm -f ${BOOST_BASENAME}.tar.gz && \ - cd .. && \ - mkdir app - -ADD ./ /tmp/app - -RUN \ - cd app && \ - git submodule update --init --recursive && \ - cmake -DBOOST_ROOT=${BOOST_ROOT} -G "Unix Makefiles" && \ - make rai_node && \ - cp rai_node /usr/local/bin/rai_node && \ - ln -s /usr/local/bin/rai_node /usr/bin/rai_node && \ - cd .. && \ - rm -rf app && \ - rm -rf ${BOOST_ROOT} - -ADD ./docker_init.sh /usr/local/bin/rai_node_init.sh - -RUN chmod +x /usr/local/bin/rai_node_init.sh - -WORKDIR /root - -VOLUME /root/RaiBlocks - -EXPOSE 7075 7076 - -ENTRYPOINT ["/bin/bash", "/usr/local/bin/rai_node_init.sh"] diff --git a/ci/build-travis.sh b/ci/build-travis.sh new file mode 100755 index 00000000..c00d9f28 --- /dev/null +++ b/ci/build-travis.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e +OS=`uname` + +mkdir build +pushd build + +cmake \ + -DACTIVE_NETWORK=rai_test_network \ + -DRAIBLOCKS_TEST=ON \ + -DRAIBLOCKS_GUI=ON \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DBOOST_ROOT=/usr/local \ + -DQt5_DIR=$1 \ + .. + +make -j2 rai_node +make -j2 core_test + +if [[ "$OS" == 'Linux' ]]; then + make -j2 rai_wallet +else + sudo make -j2 rai_wallet +fi + +# Exclude flaky or stalling tests. +#./core_test --gtest_filter="-gap_cache.gap_bootstrap:bulk_pull.get_next_on_open:system.system_genesis" + +popd diff --git a/docker/ci/Dockerfile b/docker/ci/Dockerfile new file mode 100644 index 00000000..aae52f06 --- /dev/null +++ b/docker/ci/Dockerfile @@ -0,0 +1,27 @@ +FROM ubuntu:16.04 + +ENV BOOST_BASENAME=boost_1_66_0 \ + BOOST_URL=http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz/download + +RUN apt-get update && apt-get install -yq \ + build-essential \ + cmake \ + g++ \ + wget + +WORKDIR "/tmp" + +RUN wget -O ${BOOST_BASENAME}.tar.gz ${BOOST_URL} && \ + tar xzvf ${BOOST_BASENAME}.tar.gz && \ + cd ${BOOST_BASENAME} && \ + ./bootstrap.sh && \ + ./b2 link=static install && \ + rm -rf ${BOOST_BASENAME} && \ + rm -f ${BOOST_BASENAME}.tar.gz && \ + cd .. + +RUN apt-get install -yq \ + qt5-default \ + valgrind + +RUN rm -rf /tmp/* diff --git a/docker/ci/build.sh b/docker/ci/build.sh new file mode 100755 index 00000000..e687ec77 --- /dev/null +++ b/docker/ci/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +REPO_ROOT=`git rev-parse --show-toplevel` +pushd $REPO_ROOT +docker build -f docker/ci/Dockerfile -t raiblocks-ci:latest . +popd diff --git a/docker/node/Dockerfile b/docker/node/Dockerfile new file mode 100644 index 00000000..f2f70afd --- /dev/null +++ b/docker/node/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:16.04 + +ENV BOOST_BASENAME=boost_1_66_0 \ + BOOST_ROOT=/tmp/boost_install \ + BOOST_URL=http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz/download + +RUN apt-get update && apt-get install -yq \ + build-essential \ + cmake \ + g++ \ + wget + +WORKDIR "/tmp" + +RUN wget -O ${BOOST_BASENAME}.tar.gz ${BOOST_URL} && \ + tar xzvf ${BOOST_BASENAME}.tar.gz && \ + cd ${BOOST_BASENAME} && \ + ./bootstrap.sh && \ + ./b2 --prefix=${BOOST_ROOT} link=static install && \ + rm -rf ${BOOST_BASENAME} && \ + rm -f ${BOOST_BASENAME}.tar.gz && \ + cd .. + +ADD ./ /tmp/src + +RUN mkdir /tmp/build && \ + cd /tmp/build && \ + cmake /tmp/src -DBOOST_ROOT=${BOOST_ROOT} && \ + make rai_node && \ + cd .. + +FROM ubuntu:16.04 +COPY --from=0 /tmp/build/rai_node /usr/bin +COPY --from=0 /tmp/build/librai_lib.so /usr/bin +CMD ["rai_node", "--daemon"] diff --git a/docker/node/build.sh b/docker/node/build.sh new file mode 100755 index 00000000..c873913b --- /dev/null +++ b/docker/node/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash +REPO_ROOT=`git rev-parse --show-toplevel` +COMMIT_SHA=`git rev-parse --short HEAD` +pushd $REPO_ROOT +docker build -f docker/node/Dockerfile -t raiblocks-node:latest . +popd diff --git a/docker_init.sh b/docker_init.sh deleted file mode 100644 index cecfc41e..00000000 --- a/docker_init.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -e - -DATA_DIRECTORY="/root/RaiBlocks" - -# check if data directory exist -if [[ ! $(ls -A "$DATA_DIRECTORY" 2> /dev/null) ]]; then - # this command is going to fail, but needed to initiate the data directory - /usr/local/bin/rai_node --daemon 2> /dev/null || - - echo "please ignore any errors above this line..." - - # replace RPC address in config.json for docker - sed -i "s/\"address\": \"::1\"/\"address\": \"::ffff:0.0.0.0\"/g" "$DATA_DIRECTORY"/config.json -fi - -if [[ $1 ]]; then - echo "executing command $1..." - exec $1 -else - echo "running rai_node --daemon..." - exec /usr/local/bin/rai_node --daemon -fi