Travis: run luacheck just once (#1230)

This also helps to easier spot failures because of this when looking
at the build matrix.

 - Add new check-qa target, to be run only once.
 - Add explicit check-unit-coverage target, used with DO_COVERAGE.
This commit is contained in:
Daniel Hahler 2016-11-27 15:24:04 +01:00 committed by GitHub
parent 41a055cf83
commit 333cd6491f
2 changed files with 17 additions and 9 deletions

View File

@ -10,7 +10,7 @@ branches:
env: env:
matrix: matrix:
- LUA=5.2 LUANAME=lua5.2 BUILD_APIDOC=true DO_COVERAGE=coveralls - LUA=5.2 DO_CHECKQA=1 LUANAME=lua5.2 BUILD_APIDOC=true DO_COVERAGE=coveralls
# luajit: installed from source. # 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 - 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
# Note: luarocks does not work with Lua 5.0. # Note: luarocks does not work with Lua 5.0.
@ -85,8 +85,8 @@ install:
# Install busted for "make check-unit". # Install busted for "make check-unit".
- travis_retry sudo luarocks install busted - travis_retry sudo luarocks install busted
# Install luacheck for "make luacheck". # Install luacheck for "make check-qa".
- travis_retry sudo luarocks install luacheck - if [ "$DO_QUECKQA" = 1 ]; then travis_retry sudo luarocks install luacheck; fi
# Install ldoc for building docs. # Install ldoc for building docs.
- travis_retry sudo luarocks install ldoc 1.4.4 - travis_retry sudo luarocks install ldoc 1.4.4
@ -153,12 +153,13 @@ script:
if [ "$TRAVIS_TEST_RESULT" = 0 ]; then if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
do_codecov samples do_codecov samples
fi fi
# Run check-unit{,-coverage} and check-integration.
- | - |
set -ev set -ev
if [ "$TRAVIS_TEST_RESULT" = 0 ]; then if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
if [ "$DO_COVERAGE" != "0" ]; then if [ "$DO_COVERAGE" != "0" ]; then
travis_fold_start "DO_COVERAGE" travis_fold_start "DO_COVERAGE"
(make check-coverage \ (make check-unit-coverage \
&& do_codecov unittests \ && do_codecov unittests \
&& sed -i "1 i\\require('luacov.runner')('"$PWD"/.luacov')" build/awesomerc.lua \ && sed -i "1 i\\require('luacov.runner')('"$PWD"/.luacov')" build/awesomerc.lua \
&& BUILD_DIRECTORY="" tests/run.sh \ && BUILD_DIRECTORY="" tests/run.sh \
@ -167,9 +168,15 @@ script:
travis_fold_end travis_fold_end
[ "$ret" = 0 ] [ "$ret" = 0 ]
else else
travis_run_in_fold "make.check" make check travis_run_in_fold "make.check-unit" make check-unit
travis_run_in_fold "make.check-integration" make check-integration
fi fi
fi fi
# Run check-qa.
- |
if [ "$DO_CHECKQA" = 1 ]; then
travis_run_in_fold "make.check-qa" make check-qa
fi
- | - |
set -ev set -ev
if [ "$TEST_PREV_COMMITS" = 1 ] && ! [ "$TRAVIS_PULL_REQUEST" = false ]; then if [ "$TEST_PREV_COMMITS" = 1 ] && ! [ "$TRAVIS_PULL_REQUEST" = false ]; then

View File

@ -295,7 +295,7 @@ if(GENERATE_DOC)
WORKING_DIRECTORY ${AWE_DOC_DIR} WORKING_DIRECTORY ${AWE_DOC_DIR}
DEPENDS ${AWE_LUA_FILES} ${AWE_MD_FILES} DEPENDS ${AWE_LUA_FILES} ${AWE_MD_FILES}
) )
list(APPEND CHECK_TARGETS check-ldoc-warnings) list(APPEND CHECK_QA_TARGETS check-ldoc-warnings)
endif() endif()
# }}} # }}}
@ -395,7 +395,7 @@ if(BUSTED_EXECUTABLE)
list(APPEND CHECK_TARGETS check-unit) list(APPEND CHECK_TARGETS check-unit)
# Same as above, but with --coverage argument # Same as above, but with --coverage argument
add_custom_target(check-coverage add_custom_target(check-unit-coverage
"BUILD_DIRECTORY=${CMAKE_BINARY_DIR}/" "BUILD_DIRECTORY=${CMAKE_BINARY_DIR}/"
${BUSTED_EXECUTABLE} "--helper=${CMAKE_SOURCE_DIR}/spec/preload.lua" ${BUSTED_EXECUTABLE} "--helper=${CMAKE_SOURCE_DIR}/spec/preload.lua"
"--lpath=${CMAKE_BINARY_DIR}/lib/?.lua;${CMAKE_BINARY_DIR}/lib/?/init.lua;spec/?.lua" "--lpath=${CMAKE_BINARY_DIR}/lib/?.lua;${CMAKE_BINARY_DIR}/lib/?/init.lua;spec/?.lua"
@ -411,9 +411,10 @@ if(LUACHECK_EXECUTABLE)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running Luacheck" COMMENT "Running Luacheck"
VERBATIM) VERBATIM)
list(APPEND CHECK_TARGETS luacheck) list(APPEND CHECK_QA_TARGETS luacheck)
endif() endif()
add_custom_target(check DEPENDS ${CHECK_TARGETS}) add_custom_target(check-qa DEPENDS ${CHECK_QA_TARGETS})
add_custom_target(check DEPENDS ${CHECK_TARGETS} check-qa)
# }}} # }}}
INCLUDE(${CMAKE_SOURCE_DIR}/Packaging.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/Packaging.cmake)