diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index da5164ffd7fc1d673d98e8f525aed9d204ad7efa..9606f50919f807da4661fac790459d5152f3faed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -109,7 +109,7 @@ CbmRoot_Merge: - ls - pwd - cat Dart.cfg - - $PWD/Dart.sh Continuous Dart.cfg + - $PWD/Dart.sh MergeRequest Dart.cfg pages: stage: documentation diff --git a/CbmRoot_test.cmake b/CbmRoot_test.cmake index e357f65ae2534cfbe6c82b0f3aae9b1f8a0ecfd8..8d2960c521ed1cfc6242fea46e7049649c71c288 100644 --- a/CbmRoot_test.cmake +++ b/CbmRoot_test.cmake @@ -85,7 +85,7 @@ Ctest_Read_Custom_Files("${CTEST_BINARY_DIRECTORY}") Ctest_Start($ENV{ctest_model}) -If($ENV{ctest_model} MATCHES Continuous) +If($ENV{ctest_model} MATCHES Continuous OR $ENV{ctest_model} MATCHES MergeRequest) set(ENV{ctest_model} Nightly) EndIf() @@ -102,7 +102,11 @@ If(NOT _RETVAL) CTest_Submit(PARTS Update Configure Build) EndIf() - Ctest_Test(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL $ENV{number_of_processors}) + Ctest_Test(BUILD "${CTEST_BINARY_DIRECTORY}" + PARALLEL_LEVEL $ENV{number_of_processors} + RETURN_VALUE _ctest_test_ret_val + ) + If($ENV{ctest_model} MATCHES Continuous) CTest_Submit(PARTS Test) EndIf() @@ -118,6 +122,12 @@ If(NOT _RETVAL) If(NOT $ENV{ctest_model} MATCHES Continuous) Ctest_Submit() EndIf() + + # Pipeline should fail also in case of failed tests + if (_ctest_test_ret_val) + Message(FATAL_ERROR "Some tests failed.") + endif() + Else() CTest_Submit() -EndIf() \ No newline at end of file +EndIf() diff --git a/Dart.sh b/Dart.sh index 6064523f923850f3cc839a111bbe45e9b3067a1c..84205a6c869f70e4c4f341e62e5c0f40baa29b93 100755 --- a/Dart.sh +++ b/Dart.sh @@ -43,11 +43,11 @@ if [ "$#" -lt "2" ]; then fi # test if a ctest model is either Experimental or Nightly -if [ "$1" == "Experimental" -o "$1" == "Nightly" -o "$1" == "Continuous" -o "$1" == "Profile" -o "$1" == "Weekly" ]; then +if [ "$1" == "Experimental" -o "$1" == "Nightly" -o "$1" == "Continuous" -o "$1" == "Profile" -o "$1" == "Weekly" -o "$1" == "MergeRequest" ]; then echo "" else echo "-- Error -- This ctest model is not supported." - echo "-- Error -- Possible arguments are Nightly, Experimental, Continuous or Profile." + echo "-- Error -- Possible arguments are Nightly, Experimental, Continuous, Profile or MergeRequest." exit 1 fi @@ -80,7 +80,7 @@ fi if [ "${ctest_model}" == "Weekly" ]; then export LABEL1=${LINUX_FLAVOUR}-$SYSTEM-$COMPILER$GCC_VERSION-${ctest_model}-fairsoft_$FAIRSOFT_VERSION-fairroot_$FAIRROOT_VERSION -elif [ "${ctest_model}" == "Continuous" ]; then +elif [ "${ctest_model}" == "MergeRequest" ]; then export LABEL1=${LINUX_FLAVOUR}-$SYSTEM-$COMPILER$GCC_VERSION-fairsoft_$FAIRSOFT_VERSION-fairroot_${FAIRROOT_VERSION}_MR-$CI_MERGE_REQUEST_IID else export LABEL1=${LINUX_FLAVOUR}-$SYSTEM-$COMPILER$GCC_VERSION-fairsoft_$FAIRSOFT_VERSION-fairroot_$FAIRROOT_VERSION