From 1839b9c29d201d7228e67da741b8a2af45f8480e Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 7 Jun 2018 14:22:09 +0200 Subject: [PATCH] ctest: allow script_ci.sh to run on non CI machine --- cmake/ctest/script_ci.ctest | 2 +- cmake/ctest/script_experimental.ctest | 6 +++--- cmake/ctest/utils.ctest | 21 ++++++++++++++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/cmake/ctest/script_ci.ctest b/cmake/ctest/script_ci.ctest index f3126f45..db2ae6d4 100644 --- a/cmake/ctest/script_ci.ctest +++ b/cmake/ctest/script_ci.ctest @@ -37,7 +37,7 @@ set(ERROR_MESSAGES) set(SEPARATE_TEST_SUITES FALSE) set(RUN_COVERAGE FALSE) set(RUN_MEMCHECK FALSE) -set(SUBMIT TRUE) +openrw_should_submit_ci(SUBMIT) # Build with no data and test set(BUILDER_NAME "${BUILDER_NAME_BASE}-nodata") diff --git a/cmake/ctest/script_experimental.ctest b/cmake/ctest/script_experimental.ctest index 404a7488..238b9cd8 100644 --- a/cmake/ctest/script_experimental.ctest +++ b/cmake/ctest/script_experimental.ctest @@ -43,10 +43,10 @@ endif() set(RUN_MEMCHECK FALSE) #TODO set(APPEND_RESULTS FALSE) -if($ENV{SUBMIT}) - set(SUBMIT TRUE) +if($ENV{USE_CONAN}) + set(RES TRUE) else() - set(SUBMIT FALSE) + set(RES FALSE) endif() set(EMPTY_BINARY_DIR TRUE) diff --git a/cmake/ctest/utils.ctest b/cmake/ctest/utils.ctest index e9864c67..f2a38c96 100644 --- a/cmake/ctest/utils.ctest +++ b/cmake/ctest/utils.ctest @@ -50,6 +50,7 @@ function(openrw_build_name BUILDER_NAME_RES BUILD_NAME_RES) set(REPO_BRANCH "$ENV{TRAVIS_BRANCH}") set(GIT_HASH "$ENV{TRAVIS_COMMIT}") set(_EVENT_TYPE "$ENV{TRAVIS_EVENT_TYPE}") + set(SUBMIT TRUE) elseif("$ENV{APPVEYOR}") message(STATUS "AppVeyor detected") set(BUILDER_NAME "AppVeyor") @@ -61,8 +62,15 @@ function(openrw_build_name BUILDER_NAME_RES BUILD_NAME_RES) else() set(_EVENT_TYPE "push") endif() + set(SUBMIT TRUE) else() - message(FATAL_ERROR "Unknown CI") + message("Unknown CI") + set(BUILDER_NAME "unknown") + set(REPO_NAME "repo_name") + set(REPO_BRANCH "branch") + set(GIT_HASH "git_hash") + set(_EVENT_TYPE "nop") + set(SUBMIT FALSE) endif() string(SUBSTRING "${GIT_HASH}" 0 8 GIT_HASH_SHORT) set(BUILD_NAME "${REPO_NAME}/${REPO_BRANCH}/${_EVENT_TYPE}/${GIT_HASH_SHORT}") @@ -75,3 +83,14 @@ function(openrw_build_name BUILDER_NAME_RES BUILD_NAME_RES) set("${BUILDER_NAME_RES}" "${BUILDER_NAME}" PARENT_SCOPE) set("${BUILD_NAME_RES}" "${BUILD_NAME}" PARENT_SCOPE) endfunction() + +function(openrw_should_submit_ci SHOULD_SUBMIT) + if("$ENV{TRAVIS}") + set(RES TRUE) + elseif("$ENV{APPVEYOR}") + set(RES TRUE) + else() + set(RES FALSE) + endif() + set("${SHOULD_SUBMIT}" "${RES}" PARENT_SCOPE) +endfunction()