build_rocksdb.sh

This commit is contained in:
Ștefan Talpalaru 2019-06-16 20:18:46 +02:00
parent 26b724520d
commit 4c29a519e5
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
3 changed files with 40 additions and 15 deletions

View File

@ -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

View File

@ -1,4 +1,5 @@
#!/bin/bash
# used in Travis CI and AppVeyor scripts
set -e

32
build_rocksdb.sh Executable file
View File

@ -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