awesome/.travis.yml

137 lines
5.8 KiB
YAML

sudo: required
dist: trusty
language: c
env:
matrix:
- LUA=5.2 LUANAME=lua5.2 BUILD_APIDOC=true DO_COVERAGE=coveralls
# Note: luarocks does not work with Lua 5.0.
- LUA=5.1 LUANAME=lua5.1 BUILD_IN_DIR=/tmp/awesome-build
# 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
# 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
# Lua 5.3 isn't available in Ubuntu Trusty, so some magic below installs it.
- LUA=5.3 LUANAME=lua5.3 LUALIBRARY=/usr/lib/liblua.so DO_COVERAGE=codecov
global:
# Secure GH_APIDOC_TOKEN to push to awesomeWM/apidoc.
- secure: "R/HYDclnws1I1+v9Yjt+RKa4CsFhbBT9tiwE3EfPhEj2KCYX4sFRMxuZvLf5sq0XWdrQaPhQ54fgAZGr3f054JKRXcTB0g9J6nhSHz9kIjPh446gafUhEeDQcZRwM/MeCWiwFIkiZm6smYoDFE9JTWu6quNV+lQ4kcVDOp2ibEc="
before_install:
- if [ -z $LUAINCLUDE ]; then LUAINCLUDE=/usr/include/${LUANAME}; fi
- if [ -z $LUALIBRARY ]; then LUALIBRARY=/usr/lib/x86_64-linux-gnu/lib${LUANAME}.so; fi
- cmake --version
install:
# Travis boilerplate: the apt-get cache might be out of date.
- travis_retry sudo apt-get update -qq
# Do not install recommended packages with apt-get.
- echo 'APT::Install-Recommends "false";' | sudo tee /etc/apt/apt.conf.d/no-recommends
# Install build dependencies.
# See also `apt-cache showsrc awesome | grep -E '^(Version|Build-Depends)'`.
- 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
# Deps for functional tests.
- sudo apt-get install -y dbus-x11 xterm xdotool xterm xvfb
# Install Lua (per env).
# Note that Lua 5.3 is installed manually, because it is not available in Ubuntu Trusty.
- |
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
cd lua-*
(cd 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) || exit 1
sudo make INSTALL_TOP=/usr/ INSTALL_INC=${LUAINCLUDE} TO_LIB=liblua.so linux install || exit 1
cd ..
elif [[ "$LUANAME" == "luajit-2.0" ]]; then
git clone http://luajit.org/git/luajit-2.0.git
cd luajit-2.0
sudo make install PREFIX=/usr
cd ..
# "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
else
sudo apt-get install -y lib${LUANAME}-dev ${LUANAME} ${INSTALL_PKGS}
fi
# Install luarocks (for the selected Lua version).
- |
travis_retry wget https://keplerproject.github.io/luarocks/releases/luarocks-2.3.0.tar.gz
tar xf luarocks-2.3.0.tar.gz
cd luarocks-2.3.0
./configure --lua-version=$LUA --with-lua-include=${LUAINCLUDE} ${LUAROCKS_ARGS}
make build
sudo make install
cd ..
# lgi.
- sudo apt-get install -y gir1.2-pango-1.0 libgirepository1.0-dev
- travis_retry sudo luarocks install lgi $LGIVER
# Pin lua-term (https://github.com/hoelzro/lua-term/issues/16).
- travis_retry sudo luarocks install lua-term 0.4-1
# Install busted for "make check-unit".
- travis_retry sudo luarocks install busted
# Install luacheck for "make luacheck".
- travis_retry sudo luarocks install luacheck
# Install ldoc for building docs.
- travis_retry sudo luarocks install ldoc
- travis_retry sudo luarocks install lua-discount
# Install dependencies for code coverage testing.
- if [ "$DO_COVERAGE" = "coveralls" ]; then sudo luarocks install luacov-coveralls; fi
- if [ "$DO_COVERAGE" = "codecov" ]; then sudo luarocks install luacov-coveralls; fi
- if [ "$DO_COVERAGE" = "" ]; then export DO_COVERAGE=0; fi
# Determine custom version.
- 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'
# function for codecov support
- travis_retry wget -O /tmp/codecov-bash https://codecov.io/bash
- |
do_codecov() {
if [ "$DO_COVERAGE" = "codecov" ]; then
(cd build && luacov) || exit 1
travis_retry bash /tmp/codecov-bash -F "$1" || exit 1
rm build/luacov.stats.out
fi
}
script:
- export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIBRARY} -DLUA_INCLUDE_DIR=${LUAINCLUDE} -D OVERRIDE_VERSION=$AWESOME_VERSION -D DO_COVERAGE=${DO_COVERAGE}"
- |
if [ -n "$BUILD_IN_DIR" ]; then
SOURCE_DIRECTORY="$PWD"
mkdir "$BUILD_IN_DIR"
cd "$BUILD_IN_DIR"
cmake $CMAKE_ARGS "$SOURCE_DIRECTORY"
fi
- make && sudo env PATH=$PATH make install && awesome --version
- |
if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
do_codecov samples
fi
- |
if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
if [ "$DO_COVERAGE" != "0" ]; then
make check-coverage || exit 1
do_codecov unittests
sed -i "1 i\\require('luacov.runner')('"$PWD"/.luacov')" build/awesomerc.lua || exit 1
BUILD_DIRECTORY="" tests/run.sh || exit 1
do_codecov functionaltests
else
make check
fi
fi
after_success:
# Push updated API docs for relevant branches, e.g. non-PRs builds on master.
- if [ "$BUILD_APIDOC" = "true" ]; then build-utils/travis-apidoc.sh; fi
# Push code coverage information
- if [ "$DO_COVERAGE" = "coveralls" ]; then BUILD_DIRECTORY="$(pwd)/$(readlink build)/" SOURCE_DIRECTORY="$(pwd)/" luacov-coveralls --verbose --merge; fi