From 4c29a519e5a48f0278abf987be4e5e0c708bfa94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Sun, 16 Jun 2019 20:18:46 +0200 Subject: [PATCH] build_rocksdb.sh --- .travis.yml | 22 +++++++--------------- build_nim.sh | 1 + build_rocksdb.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 15 deletions(-) create mode 100755 build_rocksdb.sh diff --git a/.travis.yml b/.travis.yml index de7cc25bb..dbf19ebca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: c # https://docs.travis-ci.com/user/caching/ cache: directories: - - rocksdb + - rocksdbCache - vendor/Nim/bin git: @@ -17,27 +17,19 @@ matrix: - os: linux sudo: required before_install: - - export INSTALL_PATH=/usr - - export NPROC=$(nproc) + - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" - os: osx before_install: - - export INSTALL_PATH=$HOME # included in DYLD_FALLBACK_LIBRARY_PATH - - export NPROC=$(sysctl -n hw.ncpu) + - launchctl setenv LIBRARY_PATH /usr/local/lib # for RocksDB install: # build our own rocksdb to test with a fixed version that we think works - - export ROCKSDBVER=5.14.2 - - "[ -f rocksdb/rocksdb-$ROCKSDBVER/Makefile ] || { rm -rf rocksdb ; mkdir -p rocksdb; cd rocksdb; wget https://github.com/facebook/rocksdb/archive/v$ROCKSDBVER.tar.gz && tar xvf v$ROCKSDBVER.tar.gz; cd ..; }" - - cd rocksdb/rocksdb-$ROCKSDBVER - - "[ -f util/build_version.cc ] || { make util/build_version.cc ; }" # use cached version if possible - - export NO_UPDATE_BUILD_VERSION=1 - - make -j${NPROC} shared_lib && sudo make install-shared - - cd ../.. + - ./build_rocksdb.sh rocksdbCache script: - set -e # fail fast - - make -j${NPROC} + - make -j2 - ./build/nimbus --help - - make -j${NPROC} test test-reproducibility - - make -C vendor/nim-beacon-chain -j${NPROC} test + - make -j2 test test-reproducibility + - make -C vendor/nim-beacon-chain -j2 test diff --git a/build_nim.sh b/build_nim.sh index a7bdc9578..0c2b44482 100755 --- a/build_nim.sh +++ b/build_nim.sh @@ -1,4 +1,5 @@ #!/bin/bash +# used in Travis CI and AppVeyor scripts set -e diff --git a/build_rocksdb.sh b/build_rocksdb.sh new file mode 100755 index 000000000..ddd7a58c8 --- /dev/null +++ b/build_rocksdb.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# used in Travis CI scripts + +set -e + +ROCKSDBVER="5.17.2" + +# script arguments +[[ $# -ne 1 ]] && { echo "usage: $0 ci_cache_dir"; exit 1; } +CI_CACHE="$1" # here we cache the installed files + +# install from cache and exit, if the version we want is already there +if [[ -n "$CI_CACHE" ]] && ls "$CI_CACHE"/lib/librocksdb* 2>/dev/null | grep -q "$ROCKSDBVER"; then + sudo cp -a "$CI_CACHE"/* /usr/local/ + exit 0 +fi + +# build it +echo "Building RocksDB" +curl -O -L -s -S https://github.com/facebook/rocksdb/archive/v$ROCKSDBVER.tar.gz +tar xzf v$ROCKSDBVER.tar.gz +cd rocksdb-$ROCKSDBVER +make DISABLE_WARNING_AS_ERROR=1 -j2 shared_lib + +# install it +if [[ -n "../$CI_CACHE" ]]; then + rm -rf "../$CI_CACHE" + mkdir "../$CI_CACHE" + make INSTALL_PATH="../$CI_CACHE" install-shared + sudo cp -a "../$CI_CACHE"/* /usr/local/ +fi +