.travis.yml: Add codecov support (#960)

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-06-11 18:47:29 +02:00 committed by Daniel Hahler
parent 0c784d1472
commit d2b9bb8c39
1 changed files with 24 additions and 6 deletions

View File

@ -3,7 +3,7 @@ dist: trusty
language: c
env:
matrix:
- LUA=5.2 LUANAME=lua5.2 BUILD_APIDOC=true DO_COVERAGE=true
- 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.
@ -11,7 +11,7 @@ env:
# 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
- 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="
@ -83,12 +83,24 @@ install:
- travis_retry sudo luarocks install ldoc
- travis_retry sudo luarocks install lua-discount
# Instal luacov-coveralls for code coverage testing.
- if [ "$DO_COVERAGE" = "true" ]; then sudo luarocks install luacov-coveralls; else export DO_COVERAGE=0; fi
# 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}"
@ -102,10 +114,16 @@ script:
- make && sudo env PATH=$PATH make install && awesome --version
- |
if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
if [ "$DO_COVERAGE" = "true" ]; 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
@ -115,4 +133,4 @@ 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" = "true" ]; then BUILD_DIRECTORY="$(pwd)/$(readlink build)/" SOURCE_DIRECTORY="$(pwd)/" luacov-coveralls --verbose --merge; fi
- if [ "$DO_COVERAGE" = "coveralls" ]; then BUILD_DIRECTORY="$(pwd)/$(readlink build)/" SOURCE_DIRECTORY="$(pwd)/" luacov-coveralls --verbose --merge; fi