Travis: Prepare for OS X builds.

* Use bot-ci script at to set up prebuilt dependencies.
 * Make CI scripts more consistent.
This commit is contained in:
Florian Walch 2014-11-27 15:10:36 +01:00
parent ad848ced11
commit 987ee79bb7
5 changed files with 102 additions and 55 deletions

View File

@ -1,19 +1,30 @@
. "$CI_SCRIPTS/common.sh"
set_environment /opt/neovim-deps/64
sudo pip install cpp-coveralls
clang_version=3.4
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
clang_version=3.4.2
clang_suffix=x86_64-unknown-ubuntu12.04.xz
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
clang_version=3.5.0
clang_suffix=macosx-apple-darwin.tar.xz
else
echo "Unknown OS '$TRAVIS_OS_NAME'."
exit 1
fi
if [ ! -d /usr/local/clang-$clang_version ]; then
echo "Downloading clang $clang_version..."
sudo mkdir /usr/local/clang-$clang_version
wget -q -O - http://llvm.org/releases/$clang_version/clang+llvm-$clang_version-x86_64-unknown-ubuntu12.04.xz \
wget -q -O - http://llvm.org/releases/$clang_version/clang+llvm-$clang_version-$clang_suffix \
| sudo tar xJf - --strip-components=1 -C /usr/local/clang-$clang_version
fi
export CC=/usr/local/clang-$clang_version/bin/clang
symbolizer=/usr/local/clang-$clang_version/bin/llvm-symbolizer
setup_prebuilt_deps x64
export SANITIZE=1
export ASAN_SYMBOLIZER_PATH=$symbolizer
export ASAN_OPTIONS="detect_leaks=1:log_path=$tmpdir/asan"
@ -22,14 +33,20 @@ export TSAN_OPTIONS="external_symbolizer_path=$symbolizer:log_path=$tmpdir/tsan"
export SKIP_UNITTEST=1
export UBSAN_OPTIONS="log_path=$tmpdir/ubsan" # not sure if this works
install_dir="$(pwd)/dist"
$MAKE_CMD cmake CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DCMAKE_INSTALL_PREFIX=$install_dir -DUSE_GCOV=ON"
CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DUSE_GCOV=ON"
# Build and output version info.
$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim
build/bin/nvim --version
# Run functional tests.
if ! $MAKE_CMD test; then
asan_check "$tmpdir"
exit 1
fi
asan_check "$tmpdir"
# Run legacy tests.
if ! $MAKE_CMD oldtest; then
reset
asan_check "$tmpdir"
@ -39,4 +56,7 @@ asan_check "$tmpdir"
coveralls --encoding iso-8859-1 || echo 'coveralls upload failed.'
$MAKE_CMD install
# Test if correctly installed.
sudo -E $MAKE_CMD install
/usr/local/bin/nvim --version
/usr/local/bin/nvim -e -c "quit"

View File

@ -35,43 +35,11 @@ check_core_dumps() {
done
}
set_environment() {
local prefix="$1/usr"
eval $($prefix/bin/luarocks path)
export PATH="$prefix/bin:$PATH"
export PKG_CONFIG_PATH="$prefix/lib/pkgconfig"
export USE_BUNDLED_DEPS=OFF
}
install_prebuilt_deps() {
# install prebuilt dependencies
if [ ! -d /opt/neovim-deps ]; then
cd /opt
sudo git clone --depth=1 git://github.com/neovim/deps neovim-deps
cd -
fi
setup_prebuilt_deps() {
eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) deps-${1}"
}
tmpdir="$(pwd)/tmp"
rm -rf "$tmpdir"
mkdir -p "$tmpdir"
suppressions="$(pwd)/.valgrind.supp"
# Travis reports back that it has 32-cores via /proc/cpuinfo, but it's not
# what we really have available. According to their documentation, it only has
# 1.5 virtual cores.
# See:
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
# for more information.
MAKE_CMD="make -j2"
install_prebuilt_deps
# Pins the version of the java package installed on the Travis VMs
# and avoids a lengthy upgrade process for them.
sudo apt-mark hold oracle-java7-installer oracle-java8-installer
sudo apt-get update
export CFLAGS='-DMIN_LOG_LEVEL=0' # force verification of DLOG macros

View File

@ -1,6 +1,6 @@
. "$CI_SCRIPTS/common.sh"
set_environment /opt/neovim-deps/32
setup_prebuilt_deps x86
# Need this to keep apt-get from removing gcc when installing libncurses
# below.
@ -21,8 +21,17 @@ CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON \
-DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib \
-DCMAKE_TOOLCHAIN_FILE=cmake/i386-linux-gnu.toolchain.cmake"
$MAKE_CMD CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS}" unittest
# Build and output version info.
$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim
build/bin/nvim --version
# Run unittests.
$MAKE_CMD unittest
# Run functional tests.
$MAKE_CMD test
check_core_dumps
# Run legacy tests.
$MAKE_CMD oldtest
check_core_dumps

View File

@ -1,23 +1,37 @@
. "$CI_SCRIPTS/common.sh"
set_environment /opt/neovim-deps/64
sudo pip install cpp-coveralls
sudo apt-get install valgrind
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
sudo apt-get install valgrind
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
brew install valgrind
else
echo "Unknown OS '$TRAVIS_OS_NAME'."
exit 1
fi
setup_prebuilt_deps x64
export VALGRIND=1
export VALGRIND_LOG="$tmpdir/valgrind-%p.log"
CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DUSE_GCOV=ON"
$MAKE_CMD CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS}" unittest
# Build and output version info.
$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim
build/bin/nvim --version
# Run unittests.
make unittest
# Run functional tests.
if ! $MAKE_CMD test; then
valgrind_check "$tmpdir"
exit 1
fi
valgrind_check "$tmpdir"
# Run legacy tests.
if ! $MAKE_CMD oldtest; then
valgrind_check "$tmpdir"
exit 1

View File

@ -1,24 +1,60 @@
language: c
os:
- linux
env:
global:
- PROJECT_ROOT="$(pwd)"
- CI_SCRIPTS="$PROJECT_ROOT/.ci"
- CI_SCRIPTS=$TRAVIS_BUILD_DIR/.ci
# Travis reports back that it has 32-cores via /proc/cpuinfo, but it's not
# what we really have available. According to their documentation, it only has
# 1.5 virtual cores.
# See
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
# for more information.
- MAKE_CMD="make -j2"
# Force verification of DLOG macros.
- CFLAGS='-DMIN_LOG_LEVEL=0'
matrix:
- CI_TARGET=clang-asan
- CI_TARGET=gcc
- CI_TARGET=gcc-32
- CI_TARGET=clint
matrix:
include:
- os: osx
env: CI_TARGET=clang-asan
- os: osx
env: CI_TARGET=gcc
compiler: gcc-4.9
allow_failures:
- os: osx
before_install:
# Pins the version of the java package installed on the Travis VMs
# and avoids a lengthy upgrade process for them.
- if [ $TRAVIS_OS_NAME = linux ]; then
sudo apt-mark hold oracle-java7-installer oracle-java8-installer;
sudo apt-get update;
elif [ $TRAVIS_OS_NAME = osx ]; then
brew update;
fi
install:
- if [ $TRAVIS_OS_NAME = linux ]; then
sudo apt-get install xclip gdb;
fi
before_script:
# Adds user to a dummy group.
# That allows to test changing the group of the file by `os_fchown`.
- sudo groupadd chown_test
- sudo usermod -a -G chown_test ${USER}
# Need xvfb for running some tests with xclip
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sudo apt-get install xclip gdb
- if [ $TRAVIS_OS_NAME = linux ]; then
sudo groupadd chown_test;
sudo usermod -a -G chown_test $USER;
export DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
elif [ $TRAVIS_OS_NAME = osx ]; then
sudo dscl . -create /Groups/chown_test;
sudo dscl . -append /Groups/chown_test GroupMembership $USER;
fi
script:
# This will pass the environment variables down to a bash process which runs
# as $USER, while retaining the environment variables defined and belonging
# to secondary groups given above in usermod.
- sudo -E su ${USER} -c "ulimit -c 102400; sh -e \"${CI_SCRIPTS}/${CI_TARGET}.sh\""
- sudo -E su $USER -c "ulimit -c 102400; sh -e \"$CI_SCRIPTS/$CI_TARGET.sh\""