Skip to content

Commit

Permalink
[ci] Add support for Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Malvineous committed May 8, 2016
1 parent dd37921 commit 64101b7
Showing 1 changed file with 127 additions and 0 deletions.
127 changes: 127 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
sudo: false

language: cpp

os:
- linux

compiler:
- clang
- gcc

matrix:
include:
- os: osx
language: cpp
osx_image: xcode7.3
compiler: clang
- os: osx
language: cpp
compiler: gcc

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- xmlto
- libpng

before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi

# Install Boost 1.60 on OSX, using a custom GCC-compiled bottle if need be
install:
- |-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew install xmlto
if [[ "$CXX" == "g++" ]]; then
brew unlink boost
wget 'https://github.com/Malvineous/travis-homebrew-bottle/releases/download/boost1.60-gcc/boost-1.60.0_2.mavericks.bottle.tar.gz'
brew install *.bottle.tar.gz
fi
fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi

# Prepare for local installs
- export LOCAL_INSTALL="$HOME/local"; mkdir "$LOCAL_INSTALL" && export PKG_CONFIG_PATH="$LOCAL_INSTALL/lib/pkgconfig"

# Install Boost if Linux
- |-
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
pushd "$HOME"
wget 'http://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.bz2'
tar jxf boost_1_60_0.tar.bz2
cd boost_1_60_0
export BOOST_HOME=`pwd`
./bootstrap.sh
./b2 --with-program_options --with-test --with-filesystem
cd "$LOCAL_INSTALL"
mkdir include && ln -s "$BOOST_HOME/boost" include/
mkdir lib && ln -s "$BOOST_HOME/stage/lib/"* lib/
export BOOST_PARAM="--with-boost=$LOCAL_INSTALL"
popd
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LOCAL_INSTALL/lib"
fi
# Install libgamecommon
- git clone http://github.com/Malvineous/libgamecommon.git
- pushd libgamecommon && ./autogen.sh && ./configure --prefix="$LOCAL_INSTALL" "$BOOST_PARAM" && make && make install && popd

# Install libgamearchive
- git clone http://github.com/Malvineous/libgamearchive.git
- pushd libgamearchive && ./autogen.sh && ./configure --prefix="$LOCAL_INSTALL" "$BOOST_PARAM" && make && make install && popd

# Install png++
- |-
wget http://download.savannah.gnu.org/releases/pngpp/png++-0.2.9.tar.gz
tar zxf png++-0.2.9.tar.gz
pushd png++-0.2.9
# OSX fix
mv error.hpp error.old
cat error.old | sed 's/(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE/((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) \&\& !_GNU_SOURCE) || (!__GLIBC__)/' > error.hpp
diff -Nru error.old error.hpp
make install PREFIX="$LOCAL_INSTALL"
popd
before_script:
- ./autogen.sh

script:
- ./configure "$BOOST_PARAM" CXXFLAGS="-I$LOCAL_INSTALL/include" || cat config.log
- make && ulimit -c unlimited -S && make check

after_failure:
- |-
if [ -f tests/tests.log ]; then
cat tests/tests.log && sleep 5
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
if [ -f core ]; then
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:./src/.libs/"
gdb ./tests/.libs/tests core -ex "thread apply all bt" -ex "set pagination 0" -batch
else
echo "No core dump; skipping gdb for backtrace"
fi
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
# Make the build output lib dir located where dylib looks as default fallback,
# since setting DYLD_FALLBACK_LIBRARY_PATH doesn't seem to work
ln -s `pwd`"/src/.libs" "$HOME/lib"
# Run the tests with core dumps enabled
ulimit -c unlimited && ./tests/.libs/tests --no_catch_system_errors
# Look for a core dump and examine it if found
COREFILE=`ls -t /cores/* | head -n1`
if [ -f "$COREFILE" ]; then
echo "Found core dump: $COREFILE"
lldb -c "$COREFILE" --batch -o 'thread backtrace all' -o 'quit'
else
echo "No core dump; skipping lldb for backtrace"
fi
else
echo "Unknown OS, cannot check for core dump"
fi
fi
- echo == End of test log ==

0 comments on commit 64101b7

Please sign in to comment.