2015-10-16 16:48:37 +02:00
sudo : required
dist : trusty
2015-04-26 04:00:50 +02:00
language : c
env :
matrix :
2016-06-11 18:47:29 +02:00
- LUA=5.2 LUANAME=lua5.2 BUILD_APIDOC=true DO_COVERAGE=coveralls
2016-07-05 22:14:41 +02:00
# luajit: installed from source.
- LUA=5.1 LUANAME=luajit-2.0 LUALIBRARY=/usr/lib/libluajit-5.1.so LUAROCKS_ARGS=--lua-suffix=jit-2.0.4 TEST_PREV_COMMITS=1
2015-04-26 04:00:50 +02:00
# Note: luarocks does not work with Lua 5.0.
2016-05-08 18:07:42 +02:00
- LUA=5.1 LUANAME=lua5.1 BUILD_IN_DIR=/tmp/awesome-build
2016-05-08 20:58:19 +02:00
# Lua 5.2 with older lgi and screen size not divisible by 2.
- LUA=5.2 LUANAME=lua5.2 LGIVER=0.7.1 TESTS_SCREEN_SIZE=1921x1079
2016-04-18 22:35:50 +02:00
# Lua 5.3 isn't available in Ubuntu Trusty, so some magic below installs it.
2016-06-11 18:47:29 +02:00
- LUA=5.3 LUANAME=lua5.3 LUALIBRARY=/usr/lib/liblua.so DO_COVERAGE=codecov
2015-07-23 23:28:39 +02:00
global :
2016-05-01 18:06:18 +02:00
# Secure GH_APIDOC_TOKEN to push to awesomeWM/apidoc.
- secure : "R/HYDclnws1I1+v9Yjt+RKa4CsFhbBT9tiwE3EfPhEj2KCYX4sFRMxuZvLf5sq0XWdrQaPhQ54fgAZGr3f054JKRXcTB0g9J6nhSHz9kIjPh446gafUhEeDQcZRwM/MeCWiwFIkiZm6smYoDFE9JTWu6quNV+lQ4kcVDOp2ibEc="
2016-08-13 00:21:33 +02:00
matrix :
allow_failures :
# This fails too often for reasons to be investigated.
# See https://github.com/awesomeWM/awesome/issues/982#issuecomment-231522318.
- env : LUA=5.1 LUANAME=luajit-2.0 LUALIBRARY=/usr/lib/libluajit-5.1.so LUAROCKS_ARGS=--lua-suffix=jit-2.0.4 TEST_PREV_COMMITS=1
2015-07-23 23:28:39 +02:00
2015-05-26 16:05:07 +02:00
before_install :
2015-10-16 16:48:37 +02:00
- if [ -z $LUAINCLUDE ]; then LUAINCLUDE=/usr/include/${LUANAME}; fi
2016-01-24 15:52:29 +01:00
- if [ -z $LUALIBRARY ]; then LUALIBRARY=/usr/lib/x86_64-linux-gnu/lib${LUANAME}.so; fi
2015-05-26 16:05:07 +02:00
- cmake --version
2015-04-26 04:00:50 +02:00
install :
# Travis boilerplate: the apt-get cache might be out of date.
2015-12-17 00:18:20 +01:00
- travis_retry sudo apt-get update -qq
2015-04-26 04:00:50 +02:00
# Do not install recommended packages with apt-get.
- echo 'APT::Install-Recommends "false";' | sudo tee /etc/apt/apt.conf.d/no-recommends
2015-10-16 16:48:37 +02:00
# Install build dependencies.
# See also `apt-cache showsrc awesome | grep -E '^(Version|Build-Depends)'`.
2016-04-13 11:20:16 +02:00
- sudo apt-get install -y libcairo2-dev gtk+3.0 xmlto asciidoc libpango1.0-dev libxcb-xtest0-dev libxcb-icccm4-dev libxcb-randr0-dev libxcb-keysyms1-dev libxcb-xinerama0-dev libdbus-1-dev libxdg-basedir-dev libstartup-notification0-dev imagemagick libxcb1-dev libxcb-shape0-dev libxcb-util0-dev libx11-xcb-dev libxcb-cursor-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev
2015-04-26 04:00:50 +02:00
2015-10-16 16:48:37 +02:00
# Deps for functional tests.
2016-06-11 13:12:33 +02:00
- sudo apt-get install -y dbus-x11 xterm xdotool xterm xvfb
2015-04-26 04:00:50 +02:00
2015-10-16 16:48:37 +02:00
# Install Lua (per env).
2016-04-18 22:35:50 +02:00
# Note that Lua 5.3 is installed manually, because it is not available in Ubuntu Trusty.
2016-01-24 15:52:29 +01:00
- |
2016-08-14 02:25:20 +02:00
set -ev
2016-02-11 21:40:22 +01:00
if [[ "$LUA" == "5.3" ]]; then
wget http://www.lua.org/ftp/lua-5.3.2.tar.gz -O lua.tar.gz
tar -xvzf lua.tar.gz
2016-08-14 02:25:20 +02:00
(cd lua-5.3.2/src \
&& make SYSCFLAGS="-DLUA_USE_LINUX -ULUA_COMPAT_5_2 -DLUA_USE_APICHECK" SYSLIBS="-Wl,-E -ldl -lreadline" LUA_A=liblua.so MYCFLAGS="-fPIC" RANLIB=: AR="gcc -shared -ldl -o" liblua.so \
&& cd .. \
&& sudo make INSTALL_TOP=/usr/ INSTALL_INC=${LUAINCLUDE} TO_LIB=liblua.so linux install)
2016-04-06 01:29:57 +02:00
elif [[ "$LUANAME" == "luajit-2.0" ]]; then
git clone http://luajit.org/git/luajit-2.0.git
2016-08-14 02:25:20 +02:00
(cd luajit-2.0 && sudo make install PREFIX=/usr)
2016-04-06 01:29:57 +02:00
# "Create" /usr/bin/lua if needed (Yup, this is a bad hack)
if [ ! -e "/usr/bin/lua" ]; then sudo ln -s /usr/bin/luajit /usr/bin/lua; fi
2016-02-11 21:40:22 +01:00
else
sudo apt-get install -y lib${LUANAME}-dev ${LUANAME} ${INSTALL_PKGS}
fi
2016-01-24 15:52:29 +01:00
2015-04-26 04:00:50 +02:00
# Install luarocks (for the selected Lua version).
2016-04-06 01:48:30 +02:00
- |
travis_retry wget https://keplerproject.github.io/luarocks/releases/luarocks-2.3.0.tar.gz
tar xf luarocks-2.3.0.tar.gz
2016-08-14 02:25:20 +02:00
(cd luarocks-2.3.0 \
&& ./configure --lua-version=$LUA --with-lua-include=${LUAINCLUDE} ${LUAROCKS_ARGS} \
&& make build \
&& sudo make install)
2015-04-26 04:00:50 +02:00
2015-10-16 16:48:37 +02:00
# lgi.
- sudo apt-get install -y gir1.2-pango-1.0 libgirepository1.0-dev
- travis_retry sudo luarocks install lgi $LGIVER
2015-04-26 04:00:50 +02:00
2016-04-04 20:50:43 +02:00
# Pin lua-term (https://github.com/hoelzro/lua-term/issues/16).
- travis_retry sudo luarocks install lua-term 0.4-1
2016-02-07 15:29:04 +01:00
# Install busted for "make check-unit".
2015-10-16 16:48:37 +02:00
- travis_retry sudo luarocks install busted
2016-02-07 15:29:04 +01:00
# Install luacheck for "make luacheck".
- travis_retry sudo luarocks install luacheck
2015-04-26 04:00:50 +02:00
# Install ldoc for building docs.
2016-08-22 23:03:10 +02:00
- travis_retry sudo luarocks install ldoc 1.4.4
2015-10-16 16:48:37 +02:00
- travis_retry sudo luarocks install lua-discount
2015-07-10 13:17:50 +02:00
2016-06-11 18:47:29 +02:00
# Install dependencies for code coverage testing.
- if [ "$DO_COVERAGE" = "" ]; then export DO_COVERAGE=0; fi
2016-07-08 22:46:41 +02:00
- if [ "$DO_COVERAGE" != "0" ]; then sudo luarocks install luacov 0.11.0-1; fi
- if [ "$DO_COVERAGE" = "coveralls" ]; then sudo luarocks install luacov-coveralls; fi
2016-02-06 15:23:28 +01:00
2015-07-24 01:01:38 +02:00
# Determine custom version.
2015-07-27 15:57:11 +02:00
- export AWESOME_VERSION="${TRAVIS_BRANCH}-g$(git rev-parse --short HEAD)"
- 'if [ "$TRAVIS_PULL_REQUEST" != false ]; then AWESOME_VERSION="${AWESOME_VERSION}-PR${TRAVIS_PULL_REQUEST}"; fi'
2016-06-11 18:47:29 +02:00
# function for codecov support
- travis_retry wget -O /tmp/codecov-bash https://codecov.io/bash
- |
do_codecov() {
if [ "$DO_COVERAGE" = "codecov" ]; then
2016-08-14 02:25:20 +02:00
(cd build && luacov) || return 1
2016-09-20 19:53:10 +02:00
travis_retry bash /tmp/codecov-bash -X coveragepy -c -F "$1" || return 1
2016-06-11 18:47:29 +02:00
rm build/luacov.stats.out
fi
2016-08-14 02:25:20 +02:00
return 0
2016-06-11 18:47:29 +02:00
}
2015-07-24 01:01:38 +02:00
2016-07-05 22:14:41 +02:00
# Functions for custom Travis folds.
- |
travis_fold_start() {
echo -n "travis_"
echo "fold:start:$1"
travis_fold_current="$1"
}
travis_fold_end() {
echo -n "travis_"
echo "fold:end:$travis_fold_current"
}
travis_run_in_fold() {
travis_fold_start "$1"
shift
"$@"
local result="$?"
travis_fold_end
return $result
}
2015-04-26 04:00:50 +02:00
script :
2016-08-20 18:59:28 +02:00
- export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIBRARY} -DLUA_INCLUDE_DIR=${LUAINCLUDE} -D OVERRIDE_VERSION=$AWESOME_VERSION -D DO_COVERAGE=${DO_COVERAGE} -DSTRICT_TESTS=true"
2016-05-08 18:07:42 +02:00
- |
2016-08-14 02:25:20 +02:00
set -ev
2016-05-08 18:07:42 +02:00
if [ -n "$BUILD_IN_DIR" ]; then
2016-07-05 22:14:41 +02:00
# Explicitly remove the Makefile to not build from the src dir accidentally.
rm Makefile
SOURCE_DIRECTORY="$PWD"
mkdir "$BUILD_IN_DIR"
cd "$BUILD_IN_DIR"
travis_run_in_fold "build_in_dir" cmake $CMAKE_ARGS "$SOURCE_DIRECTORY"
fi
- travis_run_in_fold "make" make
- |
if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
travis_run_in_fold "make.install" sudo env PATH=$PATH make install
awesome --version
2016-05-08 18:07:42 +02:00
fi
2016-02-06 17:18:23 +01:00
- |
2016-06-05 16:12:57 +02:00
if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
2016-06-11 18:47:29 +02:00
do_codecov samples
fi
- |
2016-08-14 02:25:20 +02:00
set -ev
2016-06-11 18:47:29 +02:00
if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
if [ "$DO_COVERAGE" != "0" ]; then
2016-07-05 22:14:41 +02:00
travis_fold_start "DO_COVERAGE"
(make check-coverage \
&& do_codecov unittests \
&& sed -i "1 i\\require('luacov.runner')('"$PWD"/.luacov')" build/awesomerc.lua \
&& BUILD_DIRECTORY="" tests/run.sh \
&& do_codecov functionaltests)
ret=$?
travis_fold_end
2016-08-14 02:25:20 +02:00
[ "$ret" = 0 ]
2016-06-05 16:12:57 +02:00
else
2016-07-05 22:14:41 +02:00
travis_run_in_fold "make.check" make check
fi
fi
- |
2016-08-14 02:25:20 +02:00
set -ev
2016-07-05 22:14:41 +02:00
if [ "$TEST_PREV_COMMITS" = 1 ] && ! [ "$TRAVIS_PULL_REQUEST" = false ]; then
# Check each commit separately (to make git-bisect less annoying).
echo "Testing previous commits based on TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE"
rev_list="$(git rev-list --bisect-all $TRAVIS_COMMIT_RANGE)"
echo "rev-list: $rev_list"
commits="$(echo $rev_list | grep -v 'dist=0' | cut -d\ -f 1)"
echo "Testing commits: $commits"
n ="$(echo commits | wc -l)"
i=0
failed=
for commit in $commits; do
i=$((i+1))
travis_fold_start "test_commit_${commit}_.$i.$n"
echo "Testing commit $commit"
git checkout "$commit"
git --no-pager show --stat
if ! make all check; then
failed="$failed $commit"
fi
travis_fold_end
done
if [ -n "$failed" ]; then
echo "Checks failed for these commits:$failed"
2016-08-14 02:25:20 +02:00
false
2016-06-05 16:12:57 +02:00
fi
2016-02-06 17:18:23 +01:00
fi
2015-07-23 23:28:39 +02:00
after_success :
2015-07-27 15:57:11 +02:00
# Push updated API docs for relevant branches, e.g. non-PRs builds on master.
2015-10-10 23:08:20 +02:00
- if [ "$BUILD_APIDOC" = "true" ]; then build-utils/travis-apidoc.sh; fi
2016-02-06 15:23:28 +01:00
# Push code coverage information
2016-06-11 18:47:29 +02:00
- if [ "$DO_COVERAGE" = "coveralls" ]; then BUILD_DIRECTORY="$(pwd)/$(readlink build)/" SOURCE_DIRECTORY="$(pwd)/" luacov-coveralls --verbose --merge; fi