mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Travis CI: Refactor travis script
To simplify modification/inclusion of continuous integration targets, this removes travis.sh which contains a big if statement in favor of multiple scripts under the new '.ci' directory.
This commit is contained in:
parent
cb809069a8
commit
6483a198e4
19
.ci/api-python.sh
Normal file
19
.ci/api-python.sh
Normal file
@ -0,0 +1,19 @@
|
||||
. "$CI_SCRIPTS/common.sh"
|
||||
|
||||
set_environment /opt/neovim-deps
|
||||
|
||||
sudo apt-get install expect valgrind
|
||||
|
||||
$MAKE_CMD
|
||||
|
||||
git clone --depth=1 -b master git://github.com/neovim/python-client
|
||||
cd python-client
|
||||
sudo pip install .
|
||||
sudo pip install nose
|
||||
test_cmd="nosetests --verbosity=2"
|
||||
nvim_cmd="valgrind -q --track-origins=yes --leak-check=yes --suppressions=$suppressions --log-file=$tmpdir/valgrind-%p.log ../build/bin/nvim -u NONE"
|
||||
if ! ../scripts/run-api-tests.exp "$test_cmd" "$nvim_cmd"; then
|
||||
valgrind_check "$tmpdir"
|
||||
exit 1
|
||||
fi
|
||||
valgrind_check "$tmpdir"
|
39
.ci/clang-asan.sh
Normal file
39
.ci/clang-asan.sh
Normal file
@ -0,0 +1,39 @@
|
||||
. "$CI_SCRIPTS/common.sh"
|
||||
|
||||
set_environment /opt/neovim-deps
|
||||
|
||||
sudo pip install cpp-coveralls
|
||||
|
||||
clang_version=3.4
|
||||
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 \
|
||||
| sudo tar xJf - --strip-components=1 -C /usr/local/clang-$clang_version
|
||||
export CC=/usr/local/clang-$clang_version/bin/clang
|
||||
else
|
||||
export CC=clang
|
||||
fi
|
||||
symbolizer=/usr/local/clang-$clang_version/bin/llvm-symbolizer
|
||||
|
||||
export SANITIZE=1
|
||||
export ASAN_SYMBOLIZER_PATH=$symbolizer
|
||||
export ASAN_OPTIONS="detect_leaks=1:log_path=$tmpdir/asan"
|
||||
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"
|
||||
$MAKE_CMD
|
||||
if ! $MAKE_CMD test; then
|
||||
reset
|
||||
asan_check "$tmpdir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
asan_check "$tmpdir"
|
||||
coveralls --encoding iso-8859-1 || echo 'coveralls upload failed.'
|
||||
|
||||
$MAKE_CMD install
|
87
.ci/common.sh
Normal file
87
.ci/common.sh
Normal file
@ -0,0 +1,87 @@
|
||||
valgrind_check() {
|
||||
(
|
||||
cd $1
|
||||
set -- valgrind-[*] valgrind-*
|
||||
case $1$2 in
|
||||
'valgrind-[*]valgrind-*')
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
local err=''
|
||||
for valgrind_log in "$@"; do
|
||||
# Remove useless warning
|
||||
sed -i "$valgrind_log" \
|
||||
-e '/Warning: noted but unhandled ioctl/d' \
|
||||
-e '/could cause spurious value errors to appear/d' \
|
||||
-e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
|
||||
if [ "$(stat -c %s $valgrind_log)" != "0" ]; then
|
||||
# if after removing the warning, the log still has errors, show its
|
||||
# contents and set the flag so we exit with non-zero status
|
||||
cat "$valgrind_log"
|
||||
err=1
|
||||
fi
|
||||
done
|
||||
if [ -n "$err" ]; then
|
||||
echo "Runtime errors detected"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
)
|
||||
}
|
||||
|
||||
asan_check() {
|
||||
(
|
||||
cd $1
|
||||
set -- [*]san.[*] *san.*
|
||||
case $1$2 in
|
||||
'[*]san.[*]*san.*')
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
cat "$@"
|
||||
echo "Runtime errors detected"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
)
|
||||
}
|
||||
|
||||
set_environment() {
|
||||
local prefix="$1"
|
||||
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
|
||||
}
|
||||
|
||||
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
|
16
.ci/coverity.sh
Normal file
16
.ci/coverity.sh
Normal file
@ -0,0 +1,16 @@
|
||||
. "$CI_SCRIPTS/common.sh"
|
||||
|
||||
# temporarily disable error checking, the coverity script exits with
|
||||
# status code 1 whenever it (1) fails OR (2) is not on the correct
|
||||
# branch.
|
||||
set +e
|
||||
curl -s https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh |
|
||||
COVERITY_SCAN_PROJECT_NAME="neovim/neovim" \
|
||||
COVERITY_SCAN_NOTIFICATION_EMAIL="coverity@aktau.be" \
|
||||
COVERITY_SCAN_BRANCH_PATTERN="coverity-scan" \
|
||||
COVERITY_SCAN_BUILD_COMMAND_PREPEND="$MAKE_CMD deps" \
|
||||
COVERITY_SCAN_BUILD_COMMAND="$MAKE_CMD nvim" \
|
||||
bash
|
||||
set -e
|
||||
|
||||
exit 0
|
23
.ci/gcc-ia32.sh
Normal file
23
.ci/gcc-ia32.sh
Normal file
@ -0,0 +1,23 @@
|
||||
. "$CI_SCRIPTS/common.sh"
|
||||
set_environment /opt/neovim-deps/32
|
||||
|
||||
# Need this to keep apt-get from removing gcc when installing libncurses
|
||||
# below.
|
||||
sudo apt-get install libc6-dev libc6-dev:i386
|
||||
|
||||
# Do this separately so that things get configured correctly, otherwise
|
||||
# libncurses fails to install.
|
||||
sudo apt-get install gcc-multilib g++-multilib
|
||||
|
||||
# Install the dev version to get the pkg-config and symlinks installed
|
||||
# correctly.
|
||||
sudo apt-get install libncurses5-dev:i386
|
||||
|
||||
CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DBUSTED_OUTPUT_TYPE=color_terminal \
|
||||
-DCMAKE_SYSTEM_PROCESSOR=i386 \
|
||||
-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32 \
|
||||
-DFIND_LIBRARY_USE_LIB64_PATHS=OFF \
|
||||
-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
|
||||
$MAKE_CMD test
|
11
.ci/gcc-unittest.sh
Normal file
11
.ci/gcc-unittest.sh
Normal file
@ -0,0 +1,11 @@
|
||||
. "$CI_SCRIPTS/common.sh"
|
||||
|
||||
set_environment /opt/neovim-deps
|
||||
|
||||
sudo pip install cpp-coveralls
|
||||
|
||||
export CC=gcc
|
||||
export SKIP_EXEC=1
|
||||
$MAKE_CMD CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DBUSTED_OUTPUT_TYPE=color_terminal -DUSE_GCOV=ON" unittest
|
||||
|
||||
coveralls --encoding iso-8859-1 || echo 'coveralls upload failed.'
|
16
.travis.yml
16
.travis.yml
@ -1,15 +1,17 @@
|
||||
language: c
|
||||
env:
|
||||
global:
|
||||
- PROJECT_ROOT="$(pwd)"
|
||||
- CI_SCRIPTS="$PROJECT_ROOT/.ci"
|
||||
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
||||
# via the "travis encrypt" command using the project repo's public key
|
||||
- secure: "QEz92NyItkzQu52kCFD928jEwUYnA2OIgSyeNrp+Y3gm5rOmSZerY8hGiXyNZxocap9+qIPCapRRYU3ZYKWZPeucWMLN3aIjxAFdhugKbnmNYE1jFugb6b8N3SxiX/3206NHXlYaz0OZhh6OBAFmPUXamJC8OrWVgPNPo7wv4UQ="
|
||||
matrix:
|
||||
- TRAVIS_BUILD_TYPE=clang/asan
|
||||
- TRAVIS_BUILD_TYPE=gcc/ia32
|
||||
- TRAVIS_BUILD_TYPE=gcc/unittest
|
||||
- TRAVIS_BUILD_TYPE=clint
|
||||
- TRAVIS_BUILD_TYPE=api/python
|
||||
- TRAVIS_BUILD_TYPE=coverity
|
||||
- CI_TARGET=clang-asan
|
||||
- CI_TARGET=gcc-ia32
|
||||
- CI_TARGET=gcc-unittest
|
||||
- CI_TARGET=clint
|
||||
- CI_TARGET=api-python
|
||||
- CI_TARGET=coverity
|
||||
script:
|
||||
- ./scripts/travis.sh
|
||||
- sh -e "${CI_SCRIPTS}/${CI_TARGET}.sh"
|
||||
|
@ -1,183 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
tmpdir="$(pwd)/tmp"
|
||||
rm -rf "$tmpdir"
|
||||
mkdir -p "$tmpdir"
|
||||
suppressions="$(pwd)/.valgrind.supp"
|
||||
|
||||
valgrind_check() {
|
||||
(
|
||||
cd $1
|
||||
set -- valgrind-[*] valgrind-*
|
||||
case $1$2 in
|
||||
'valgrind-[*]valgrind-*')
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
local err=''
|
||||
for valgrind_log in "$@"; do
|
||||
# Remove useless warning
|
||||
sed -i "$valgrind_log" \
|
||||
-e '/Warning: noted but unhandled ioctl/d' \
|
||||
-e '/could cause spurious value errors to appear/d' \
|
||||
-e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
|
||||
if [ "$(stat -c %s $valgrind_log)" != "0" ]; then
|
||||
# if after removing the warning, the log still has errors, show its
|
||||
# contents and set the flag so we exit with non-zero status
|
||||
cat "$valgrind_log"
|
||||
err=1
|
||||
fi
|
||||
done
|
||||
if [ -n "$err" ]; then
|
||||
echo "Runtime errors detected"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
)
|
||||
}
|
||||
|
||||
asan_check() {
|
||||
(
|
||||
cd $1
|
||||
set -- [*]san.[*] *san.*
|
||||
case $1$2 in
|
||||
'[*]san.[*]*san.*')
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
cat "$@"
|
||||
echo "Runtime errors detected"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
)
|
||||
}
|
||||
|
||||
set_environment() {
|
||||
local prefix="$1"
|
||||
eval $($prefix/bin/luarocks path)
|
||||
export PATH="$prefix/bin:$PATH"
|
||||
export PKG_CONFIG_PATH="$prefix/lib/pkgconfig"
|
||||
export USE_BUNDLED_DEPS=OFF
|
||||
}
|
||||
|
||||
# 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
|
||||
|
||||
# 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"
|
||||
|
||||
if [ "$TRAVIS_BUILD_TYPE" = "coverity" ]; then
|
||||
# temporarily disable error checking, the coverity script exits with
|
||||
# status code 1 whenever it (1) fails OR (2) is not on the correct
|
||||
# branch.
|
||||
set +e
|
||||
curl -s https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh |
|
||||
COVERITY_SCAN_PROJECT_NAME="neovim/neovim" \
|
||||
COVERITY_SCAN_NOTIFICATION_EMAIL="coverity@aktau.be" \
|
||||
COVERITY_SCAN_BRANCH_PATTERN="coverity-scan" \
|
||||
COVERITY_SCAN_BUILD_COMMAND_PREPEND="$MAKE_CMD deps" \
|
||||
COVERITY_SCAN_BUILD_COMMAND="$MAKE_CMD nvim" \
|
||||
bash
|
||||
set -e
|
||||
exit 0
|
||||
elif [ "$TRAVIS_BUILD_TYPE" = "clang/asan" ]; then
|
||||
clang_version=3.4
|
||||
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 \
|
||||
| sudo tar xJf - --strip-components=1 -C /usr/local/clang-$clang_version
|
||||
export CC=/usr/local/clang-$clang_version/bin/clang
|
||||
else
|
||||
export CC=clang
|
||||
fi
|
||||
symbolizer=/usr/local/clang-$clang_version/bin/llvm-symbolizer
|
||||
|
||||
sudo pip install cpp-coveralls
|
||||
set_environment /opt/neovim-deps
|
||||
|
||||
export SANITIZE=1
|
||||
export ASAN_SYMBOLIZER_PATH=$symbolizer
|
||||
export ASAN_OPTIONS="detect_leaks=1:log_path=$tmpdir/asan"
|
||||
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"
|
||||
$MAKE_CMD
|
||||
if ! $MAKE_CMD test; then
|
||||
reset
|
||||
asan_check "$tmpdir"
|
||||
exit 1
|
||||
fi
|
||||
asan_check "$tmpdir"
|
||||
coveralls --encoding iso-8859-1 || echo 'coveralls upload failed.'
|
||||
$MAKE_CMD install
|
||||
elif [ "$TRAVIS_BUILD_TYPE" = "gcc/unittest" ]; then
|
||||
sudo pip install cpp-coveralls
|
||||
export CC=gcc
|
||||
set_environment /opt/neovim-deps
|
||||
export SKIP_EXEC=1
|
||||
$MAKE_CMD CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DBUSTED_OUTPUT_TYPE=color_terminal -DUSE_GCOV=ON" unittest
|
||||
coveralls --encoding iso-8859-1 || echo 'coveralls upload failed.'
|
||||
elif [ "$TRAVIS_BUILD_TYPE" = "gcc/ia32" ]; then
|
||||
set_environment /opt/neovim-deps/32
|
||||
|
||||
# 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
|
||||
|
||||
# Need this to keep apt-get from removing gcc when installing libncurses
|
||||
# below.
|
||||
sudo apt-get install libc6-dev libc6-dev:i386
|
||||
|
||||
# Do this separately so that things get configured correctly, otherwise
|
||||
# libncurses fails to install.
|
||||
sudo apt-get install gcc-multilib g++-multilib
|
||||
|
||||
# Install the dev version to get the pkg-config and symlinks installed
|
||||
# correctly.
|
||||
sudo apt-get install libncurses5-dev:i386
|
||||
|
||||
CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DBUSTED_OUTPUT_TYPE=color_terminal \
|
||||
-DCMAKE_SYSTEM_PROCESSOR=i386 \
|
||||
-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32 \
|
||||
-DFIND_LIBRARY_USE_LIB64_PATHS=OFF \
|
||||
-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
|
||||
$MAKE_CMD test
|
||||
elif [ "$TRAVIS_BUILD_TYPE" = "clint" ]; then
|
||||
./scripts/clint.sh
|
||||
elif [ "$TRAVIS_BUILD_TYPE" = "api/python" ]; then
|
||||
set_environment /opt/neovim-deps
|
||||
sudo apt-get update
|
||||
sudo apt-get install expect valgrind
|
||||
$MAKE_CMD
|
||||
git clone --depth=1 -b master git://github.com/neovim/python-client
|
||||
cd python-client
|
||||
sudo pip install .
|
||||
sudo pip install nose
|
||||
test_cmd="nosetests --verbosity=2"
|
||||
nvim_cmd="valgrind -q --track-origins=yes --leak-check=yes --suppressions=$suppressions --log-file=$tmpdir/valgrind-%p.log ../build/bin/nvim -u NONE"
|
||||
if ! ../scripts/run-api-tests.exp "$test_cmd" "$nvim_cmd"; then
|
||||
valgrind_check "$tmpdir"
|
||||
exit 1
|
||||
fi
|
||||
valgrind_check "$tmpdir"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user