diff --git a/Dart.sh b/Dart.sh index 32b0afd3..3d7067e8 100755 --- a/Dart.sh +++ b/Dart.sh @@ -41,13 +41,15 @@ if [ "$#" -lt "2" ]; then fi # test if a valid ctest model is defined -if [ "$1" == "Experimental" -o "$1" == "Nightly" -o "$1" == "Continuous" -o "$1" == "Profile" -o "$1" == "alfa_ci" ]; then - echo "" -else - echo "-- Error -- This ctest model is not supported." - echo "-- Error -- Possible arguments are Nightly, Experimental, Continuous or Profile." - exit 1 -fi +case "$1" in + Experimental|Nightly|Continuous|Profile|alfa_ci|codecov) + ;; + *) + echo "-- Error -- This ctest model is not supported." + echo "-- Error -- Possible arguments are Nightly, Experimental, Continuous or Profile." + exit 1 + ;; +esac # test if the input file exists and execute it if [ -e "$2" ];then @@ -61,6 +63,9 @@ fi # set the ctest model to command line parameter if [ "$1" == "alfa_ci" ]; then export ctest_model=Experimental +elif [ "$1" == "codecov" ]; then + export ctest_model=Profile + export do_codecov_upload=1 else export ctest_model=$1 fi @@ -83,13 +88,20 @@ else COMPILER=$CXX$($CXX -dumpversion) fi -if [ "$1" == "alfa_ci" ]; then - export LABEL1=alfa_ci-$COMPILER-FairMQ_$GIT_BRANCH - export LABEL=$(echo $LABEL1 | sed -e 's#/#_#g') -else - export LABEL1=${LINUX_FLAVOUR}-$chip-$COMPILER-FairMQ_$GIT_BRANCH - export LABEL=$(echo $LABEL1 | sed -e 's#/#_#g') -fi +case "$1" in + alfa_ci) + export LABEL1=alfa_ci-$COMPILER-FairMQ_$GIT_BRANCH + export LABEL=$(echo $LABEL1 | sed -e 's#/#_#g') + ;; + codecov) + export LABEL1=codecov-$COMPILER-FairMQ_$GIT_BRANCH + export LABEL=$(echo $LABEL1 | sed -e 's#/#_#g') + ;; + *) + export LABEL1=${LINUX_FLAVOUR}-$chip-$COMPILER-FairMQ_$GIT_BRANCH + export LABEL=$(echo $LABEL1 | sed -e 's#/#_#g') + ;; +esac # get the number of processors # and information about the host diff --git a/FairMQTest.cmake b/FairMQTest.cmake index 5f0eaa54..55e3a73e 100644 --- a/FairMQTest.cmake +++ b/FairMQTest.cmake @@ -34,18 +34,16 @@ If(EXTRA_FLAGS) Set(configure_options "${configure_options};${EXTRA_FLAGS}") EndIf() -If($ENV{ctest_model} MATCHES Nightly OR $ENV{ctest_model} MATCHES Profile) - +If($ENV{ctest_model} MATCHES Profile) Find_Program(GCOV_COMMAND gcov) If(GCOV_COMMAND) Message("Found GCOV: ${GCOV_COMMAND}") Set(CTEST_COVERAGE_COMMAND ${GCOV_COMMAND}) EndIf(GCOV_COMMAND) +EndIf() - Set(ENV{ctest_model} Nightly) - - CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) - +If($ENV{ctest_model} MATCHES Nightly OR $ENV{ctest_model} MATCHES Profile) + Ctest_Empty_Binary_Directory(${CTEST_BINARY_DIRECTORY}) EndIf() Ctest_Start($ENV{ctest_model}) @@ -62,7 +60,16 @@ Ctest_Test(BUILD "${CTEST_BINARY_DIRECTORY}" ) If(GCOV_COMMAND) - Ctest_Coverage(BUILD "${CTEST_BINARY_DIRECTORY}") + Ctest_Coverage(BUILD "${CTEST_BINARY_DIRECTORY}" LABELS coverage) +EndIf() + +If("$ENV{do_codecov_upload}") + Execute_Process(COMMAND curl https://codecov.io/bash -o codecov_uploader.sh + WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} + TIMEOUT 60) + Execute_Process(COMMAND bash ./codecov_uploader.sh -X gcov + WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} + TIMEOUT 60) EndIf() Ctest_Submit() diff --git a/Jenkinsfile b/Jenkinsfile index 58b509dd..da21cc0a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,24 +4,31 @@ def specToLabel(Map spec) { return "${spec.os}-${spec.arch}-${spec.compiler}-FairSoft_${spec.fairsoft}" } -def buildMatrix(List specs, Closure callback) { +def jobMatrix(String prefix, List specs, Closure callback) { def nodes = [:] for (spec in specs) { def label = specToLabel(spec) - nodes[label] = { + nodes["${prefix}/${label}"] = { node(label) { - githubNotify(context: "alfa-ci/${label}", description: 'Building ...', status: 'PENDING') + githubNotify(context: "${prefix}/${label}", description: 'Building ...', status: 'PENDING') try { deleteDir() checkout scm + sh '''\ + echo "export BUILDDIR=$PWD/build" >> Dart.cfg + echo "export SOURCEDIR=$PWD" >> Dart.cfg + echo "export PATH=$SIMPATH/bin:$PATH" >> Dart.cfg + echo "export GIT_BRANCH=$JOB_BASE_NAME" >> Dart.cfg + ''' + callback.call(spec, label) deleteDir() - githubNotify(context: "alfa-ci/${label}", description: 'Success', status: 'SUCCESS') + githubNotify(context: "${prefix}/${label}", description: 'Success', status: 'SUCCESS') } catch (e) { deleteDir() - githubNotify(context: "alfa-ci/${label}", description: 'Error', status: 'ERROR') + githubNotify(context: "${prefix}/${label}", description: 'Error', status: 'ERROR') throw e } } @@ -33,22 +40,25 @@ def buildMatrix(List specs, Closure callback) { pipeline{ agent none stages { - stage("Run Build/Test Matrix") { + stage("Run CI Matrix") { steps{ script { - parallel(buildMatrix([ + def build_jobs = jobMatrix('alfa-ci/build', [ [os: 'Debian8', arch: 'x86_64', compiler: 'gcc4.9', fairsoft: 'may18'], - [os: 'MacOS10.11', arch: 'x86_64', compiler: 'AppleLLVM8.0.0', fairsoft: 'may18'], [os: 'MacOS10.13', arch: 'x86_64', compiler: 'AppleLLVM9.0.0', fairsoft: 'may18'], ]) { spec, label -> - sh '''\ - echo "export BUILDDIR=$PWD/build" >> Dart.cfg - echo "export SOURCEDIR=$PWD" >> Dart.cfg - echo "export PATH=$SIMPATH/bin:$PATH" >> Dart.cfg - echo "export GIT_BRANCH=$JOB_BASE_NAME" >> Dart.cfg - ''' sh './Dart.sh alfa_ci Dart.cfg' - }) + } + + def profile_jobs = jobMatrix('alfa-ci/codecov', [ + [os: 'Debian8', arch: 'x86_64', compiler: 'gcc4.9', fairsoft: 'may18'], + ]) { spec, label -> + withCredentials([string(credentialsId: 'fairmq_codecov_token', variable: 'CODECOV_TOKEN')]) { + sh './Dart.sh codecov Dart.cfg' + } + } + + parallel(build_jobs + profile_jobs) } } } diff --git a/fairmq/CMakeLists.txt b/fairmq/CMakeLists.txt index 13e9e2a7..5817fdf9 100644 --- a/fairmq/CMakeLists.txt +++ b/fairmq/CMakeLists.txt @@ -196,6 +196,7 @@ add_library(FairMQ SHARED ${FAIRMQ_PUBLIC_HEADER_FILES} # for IDE integration ${FAIRMQ_PRIVATE_HEADER_FILES} # for IDE integration ) +set_target_properties(FairMQ PROPERTIES LABELS coverage) ####################### # include directories #