Permalink
Fetching contributors…
Cannot retrieve contributors at this time
269 lines (250 sloc) 8.31 KB
language: cpp
cache:
directories:
$HOME/.m2
$HOME/.cabal
$HOME/elektra-cabal-sandbox
$HOME/Library/Caches/Homebrew
# don't cache our own libraries generated in the build
# so they always get rebuilt properly and to avoid init issues
# we ignore the result as some or all might not exist on build
# errors, in that case unregister would fail
before_cache:
- rm -rf $HOME/.cabal/logs
- cd $HOME/elektra-cabal-sandbox
- cabal sandbox hc-pkg unregister spectranslator > /dev/null; true
- cabal sandbox hc-pkg unregister specelektra > /dev/null; true
- cabal sandbox hc-pkg unregister libfa > /dev/null; true
- cabal sandbox hc-pkg unregister libelektra-haskell > /dev/null; true
- rm -rf .cabal-sandbox/logs
- rm -f .cabal-sandbox/world
- rm -f .cabal-sandbox/add-source-timestamps
#
# Define the build matrix
#
matrix:
include:
# ASAN: Enable AddressSanitizer
- os: osx
osx_image: xcode9.4
compiler: clang
env:
- ASAN=ON
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
env:
- ASAN=ON
- CC_COMPILER=gcc-8
- CXX_COMPILER=g++-8
- os: linux
compiler: clang
addons:
apt:
sources:
- llvm-toolchain-trusty-6.0
- ubuntu-toolchain-r-test
packages:
- clang-6.0
env:
- ASAN=ON
- CC_COMPILER=clang-6.0
- CXX_COMPILER=clang++-6.0
# FULL: Build full version of Elektra (BUILD_FULL=ON)
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
env:
- FULL=ON
- CC_COMPILER=gcc-8
- CXX_COMPILER=g++-8
- os: osx
# Translating the `syslog` plugin with GCC on macOS 10.13 does not work, since GCC is unable to compile `sys/syslog.h`.
osx_image: xcode9.2
compiler: gcc
- os: osx
osx_image: xcode9.4
compiler: clang
# HASKELL: Only build Haskell binding and plugin
- os: osx
osx_image: xcode9.4
compiler: clang
env:
- HASKELL=ON
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
env:
- CC_COMPILER=gcc-8
- CXX_COMPILER=g++-8
- os: linux
compiler: clang
addons:
apt:
sources:
- llvm-toolchain-trusty-6.0
- ubuntu-toolchain-r-test
packages:
- clang-6.0
env:
- CC_COMPILER=clang-6.0
- CXX_COMPILER=clang++-6.0
before_install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
brew install ninja
brew install augeas
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" && "$HASKELL" != "ON" ]]; then
rvm install 2.3.1
rvm use 2.3.1
gem install test-unit --no-document
if [[ "$CC" == "gcc" ]]; then
brew install gcc
brew link --overwrite gcc
gcc_version_major=$(brew info gcc | head -n1 | sed -E 's/[^0-9]*([0-9]+)\..*/\1/')
export CC="gcc-$gcc_version_major"
export CXX="g++-$gcc_version_major"
else
# Use latest version of LLVM to translate the code
brew install llvm
export CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
# Linking the Homebrew versions of Botan and yaml-cpp using `gcc` fails on macOS
brew install botan
brew install yaml-cpp
# Unfortunately Xerces 3.2 causes multiple problems if we translate Elektra with GCC on macOS
brew install xerces-c
fi
brew install dbus
brew install discount
brew install libgcrypt
brew install libgit2
brew install libuv
brew install libev
brew install lua
brew install openssl
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
brew install python@2; brew link --overwrite python@2
brew install python || brew upgrade python
brew install qt
brew install swig
brew install yajl
pip2 install cheetah # Required by kdb-gen
# start D-Bus session bus
brew services start dbus
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" && "$HASKELL" == "ON" ]] ; then
# 8.4 is currently not supported by hint which we use
brew install ghc@8.2
brew link ghc@8.2 --force
brew install cabal-install
cabal update
# avoid reinstalls if we already have them cached
PATH=$PATH:"$HOME/.cabal/bin"
which happy || cabal install happy
which alex || cabal install alex
which c2hs || cabal install c2hs
export HASKELL_SHARED_SANDBOX=$HOME/elektra-cabal-sandbox
mkdir -p $HASKELL_SHARED_SANDBOX
cd $HASKELL_SHARED_SANDBOX
cabal sandbox init
# there is some strange cache bug where it complains that one of our own library's
# directory doesn't exist though it gets properly unregistered. Apparently ignoring
# that works anyway.
cabal install 'base >=4.9 && <4.12' 'containers >=0.5 && <0.6' \
'directory >=1.2 && <1.4' 'process >=1.4 && <1.7' 'binary >=0.8 && <0.9' \
'haskell-src-exts-any' 'pretty -any' 'hint >=0.7.0 && <0.8.0' 'temporary -any' \
'exceptions -any' 'text -any' 'simple-logger -any' 'megaparsec -any' \
'hspec -any' 'QuickCheck-any' --avoid-reinstalls || true
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
[[ -n "$CC_COMPILER" ]] && export CC="$CC_COMPILER"
[[ -n "$CXX_COMPILER" ]] && export CXX="$CXX_COMPILER"
sudo apt-get -qq update
sudo apt-get install ninja-build
sudo apt-get install devscripts # contains `checkbashisms`
sudo apt-get install libboost-all-dev
sudo apt-get install libyaml-cpp-dev
sudo apt-get install libuv-dev
sudo apt-get install libdbus-1-dev
sudo apt-get install libev-dev
sudo apt-get install libxerces-c-dev
sudo apt-get install moreutils # contains `sponge` required by `reformat-cmake`
sudo pip install --upgrade cmake_format==0.3.6
fi
#
# Source is checked out in $TRAVIS_BUILD_DIR
# Build directory will be TRAVIS_BUILD_DIR/../build
#
before_script:
- cd $TRAVIS_BUILD_DIR/..
- >
[[ "$TRAVIS_OS_NAME" == "linux" ]] && INSTALL_DIR="$PWD/install" || INSTALL_DIR="/usr/local"
- SYSTEM_DIR="$PWD/kdbsystem"
- mkdir build
- cd build
- >
[[ $ASAN == ON ]] && CMAKE_OPT=(-DENABLE_ASAN=ON) || CMAKE_OPT=()
- if [[ $FULL == ON ]]; then CMAKE_OPT+=(-DBUILD_FULL=ON); fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" || "$TRAVIS_OS_NAME" == "osx" ]]; then
CMAKE_OPT+=("-DCOMMON_FLAGS=-Werror")
fi
# use a minimal configuration for the haskell bindings to give it enough time to compile dependencies
- |
if [[ $HASKELL == ON ]]; then
bindings="haskell"
plugins="resolver_fm_hpu_b;dump;dini;list;spec;haskell;typechecker;ini;sync;error;base64;regexdispatcher"
tools="kdb"
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" && "$HASKELL" != "ON" ]]; then
python2_ver=$(python2 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') && \
CMAKE_OPT+=("-DPYTHON2_INCLUDE_DIR:PATH=$(python2-config --prefix)/include/python${python2_ver}") && \
CMAKE_OPT+=("-DPYTHON2_LIBRARY:FILEPATH=$(python2-config --prefix)/lib/libpython${python2_ver}.dylib") && \
python3_ver=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') && \
CMAKE_OPT+=("-DPYTHON_INCLUDE_DIR:PATH=$(python3-config --prefix)/include/python${python3_ver}m") && \
CMAKE_OPT+=("-DPYTHON_LIBRARY:FILEPATH=$(python3-config --prefix)/lib/libpython${python3_ver}.dylib")
fi
- >
cmake
-GNinja
-DPLUGINS="${plugins:-ALL;-jni}"
-DBINDINGS="${bindings:-ALL}"
-DENABLE_DEBUG=ON
-DTOOLS="${tools:-ALL;}"
-DINSTALL_SYSTEM_FILES=OFF
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR"
-DKDB_DB_SYSTEM="$SYSTEM_DIR"
${CMAKE_OPT[@]}
$TRAVIS_BUILD_DIR
- export PATH=$PATH:"$INSTALL_DIR/bin"
script:
- ninja
- |
if [[ "$ASAN" = "ON" ]]; then
ninja run_all
else
ninja install
ninja run_all && kdb run_all
fi