Commit 11072d19 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

FIXED fetch origin/develop hash before ctest_start

Fixes #4
parent b0b4a929
...@@ -115,6 +115,12 @@ while (${CTEST_ELAPSED_TIME} LESS ${CONTINUOUS_BUILD_DURATION}) ...@@ -115,6 +115,12 @@ while (${CTEST_ELAPSED_TIME} LESS ${CONTINUOUS_BUILD_DURATION})
# Get start time of the build # Get start time of the build
set(START_TIME ${CTEST_ELAPSED_TIME}) set(START_TIME ${CTEST_ELAPSED_TIME})
# set the build name using the compiler and commit hash of the origin/develop branch
# CTEST_BUILD_NAME needs to be set before ctest_start, which in turns is called before ctest_update
# therefore the current git hash should be fetch fro origin/develop
get_git_info(${CTEST_SOURCE_DIRECTORY})
set(CTEST_BUILD_NAME ${CAMITK_CONTINUOUS_INTEGRATION}-${CAMITK_ORIGIN_DEVELOP_GIT_ABBREVIATED_HASH})
# Start CTest in Continuous mode # Start CTest in Continuous mode
ctest_start(Continuous) ctest_start(Continuous)
...@@ -123,13 +129,6 @@ while (${CTEST_ELAPSED_TIME} LESS ${CONTINUOUS_BUILD_DURATION}) ...@@ -123,13 +129,6 @@ while (${CTEST_ELAPSED_TIME} LESS ${CONTINUOUS_BUILD_DURATION})
if (count GREATER 0) # We have updated source code, thus configure and build modified files if (count GREATER 0) # We have updated source code, thus configure and build modified files
# update revision number
get_git_info(${CTEST_SOURCE_DIRECTORY})
set(CURRENT_GIT_HASH ${CAMITK_GIT_ABBREVIATED_HASH})
# set the build name using the compiler and commit hash
set(CTEST_BUILD_NAME ${CAMITK_CONTINUOUS_INTEGRATION}-${CURRENT_GIT_HASH})
# show update reports if there is a change in the source code # show update reports if there is a change in the source code
ctest_submit(PARTS Update Notes) ctest_submit(PARTS Update Notes)
......
...@@ -84,6 +84,12 @@ else() ...@@ -84,6 +84,12 @@ else()
message(FATAL_ERROR "Git command not found: please install git.") message(FATAL_ERROR "Git command not found: please install git.")
endif() endif()
# set the build name using the compiler and commit hash of the origin/develop branch
# CTEST_BUILD_NAME needs to be set before ctest_start, which in turns is called before ctest_update
# therefore the current git hash should be fetch fro origin/develop
get_git_info(${CTEST_SOURCE_DIRECTORY})
set(CTEST_BUILD_NAME ${CAMITK_CONTINUOUS_INTEGRATION}-${CAMITK_ORIGIN_DEVELOP_GIT_ABBREVIATED_HASH})
# Update source code and send reports # Update source code and send reports
set(CTEST_GIT_COMMAND ${GIT_EXECUTABLE}) set(CTEST_GIT_COMMAND ${GIT_EXECUTABLE})
...@@ -112,13 +118,6 @@ ctest_start(Nightly) ...@@ -112,13 +118,6 @@ ctest_start(Nightly)
# Update source code # Update source code
ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY} RETURN_VALUE count) ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY} RETURN_VALUE count)
# update revision number
get_git_info(${CTEST_SOURCE_DIRECTORY})
set(CURRENT_GIT_HASH ${CAMITK_GIT_ABBREVIATED_HASH})
# set the build name using the compiler and commit hash
set(CTEST_BUILD_NAME ${CAMITK_CONTINUOUS_INTEGRATION}-${CURRENT_GIT_HASH})
if(count GREATER 0) if(count GREATER 0)
# We only show update when there is change (avoid the CDash u=1 bug with no errors report) # We only show update when there is change (avoid the CDash u=1 bug with no errors report)
ctest_submit(PARTS Update Notes) ctest_submit(PARTS Update Notes)
......
...@@ -42,6 +42,14 @@ macro(get_git_info PATH_TO_SOURCE_DIR) ...@@ -42,6 +42,14 @@ macro(get_git_info PATH_TO_SOURCE_DIR)
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse origin/develop
WORKING_DIRECTORY ${PATH_TO_SOURCE_DIR}
OUTPUT_VARIABLE CAMITK_ORIGIN_DEVELOP_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(SUBSTRING ${CAMITK_ORIGIN_DEVELOP_GIT_HASH} 0 8 CAMITK_ORIGIN_DEVELOP_GIT_ABBREVIATED_HASH)
if(NOT CAMITK_GIT_COMMIT_COUNT) if(NOT CAMITK_GIT_COMMIT_COUNT)
message(WARNING "Unable to find the commit number using git : ${GIT_EXECUTABLE}") message(WARNING "Unable to find the commit number using git : ${GIT_EXECUTABLE}")
set(CAMITK_GIT_COMMIT_COUNT "unknown") set(CAMITK_GIT_COMMIT_COUNT "unknown")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment