From 333cd6491f57d8ce9b7d665f2b48d8bc8e51682d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 27 Nov 2016 15:24:04 +0100 Subject: [PATCH] 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. --- .travis.yml | 17 ++++++++++++----- CMakeLists.txt | 9 +++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a5387291..525063614 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ branches: env: 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. - 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. @@ -85,8 +85,8 @@ install: # Install busted for "make check-unit". - travis_retry sudo luarocks install busted - # Install luacheck for "make luacheck". - - travis_retry sudo luarocks install luacheck + # Install luacheck for "make check-qa". + - if [ "$DO_QUECKQA" = 1 ]; then travis_retry sudo luarocks install luacheck; fi # Install ldoc for building docs. - travis_retry sudo luarocks install ldoc 1.4.4 @@ -153,12 +153,13 @@ script: if [ "$TRAVIS_TEST_RESULT" = 0 ]; then do_codecov samples fi + # Run check-unit{,-coverage} and check-integration. - | set -ev if [ "$TRAVIS_TEST_RESULT" = 0 ]; then if [ "$DO_COVERAGE" != "0" ]; then travis_fold_start "DO_COVERAGE" - (make check-coverage \ + (make check-unit-coverage \ && do_codecov unittests \ && sed -i "1 i\\require('luacov.runner')('"$PWD"/.luacov')" build/awesomerc.lua \ && BUILD_DIRECTORY="" tests/run.sh \ @@ -167,9 +168,15 @@ script: travis_fold_end [ "$ret" = 0 ] 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 + # Run check-qa. + - | + if [ "$DO_CHECKQA" = 1 ]; then + travis_run_in_fold "make.check-qa" make check-qa + fi - | set -ev if [ "$TEST_PREV_COMMITS" = 1 ] && ! [ "$TRAVIS_PULL_REQUEST" = false ]; then diff --git a/CMakeLists.txt b/CMakeLists.txt index dedb4c4fe..9c982d802 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -295,7 +295,7 @@ if(GENERATE_DOC) WORKING_DIRECTORY ${AWE_DOC_DIR} DEPENDS ${AWE_LUA_FILES} ${AWE_MD_FILES} ) - list(APPEND CHECK_TARGETS check-ldoc-warnings) + list(APPEND CHECK_QA_TARGETS check-ldoc-warnings) endif() # }}} @@ -395,7 +395,7 @@ if(BUSTED_EXECUTABLE) list(APPEND CHECK_TARGETS check-unit) # Same as above, but with --coverage argument - add_custom_target(check-coverage + add_custom_target(check-unit-coverage "BUILD_DIRECTORY=${CMAKE_BINARY_DIR}/" ${BUSTED_EXECUTABLE} "--helper=${CMAKE_SOURCE_DIR}/spec/preload.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} COMMENT "Running Luacheck" VERBATIM) - list(APPEND CHECK_TARGETS luacheck) + list(APPEND CHECK_QA_TARGETS luacheck) 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)