diff --git a/Jenkinsfile b/Jenkinsfile index d8e50df44d0fce6d04501093a22028ab044759bd..35519b898fcaace4e61de097635095e2cd9c9dd1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -@Library('jenkins-pipeline@1.0.15') _ +@Library('jenkins-pipeline@1.0.17') _ def stage_required = [build: false, data: false, full: false, docker: false] @@ -94,7 +94,10 @@ pipeline { '-DOGS_USE_PYTHON=ON ' + '-DOGS_BUILD_UTILS=ON ' } - build { log="build.log" } + build { + target="package" + log="build.log" + } build { target="tests" } build { target="ctest" } build { target="doc" } @@ -157,7 +160,10 @@ pipeline { '-DOGS_BUILD_UTILS=ON ' + '-DOGS_BUILD_TESTS=OFF ' } - build { log="build.log" } + build { + target="package" + log="build.log" + } } } post { @@ -179,7 +185,7 @@ pipeline { } agent { dockerfile { - filename 'Dockerfile.gcc.minimal' + filename 'Dockerfile.gcc.full' dir 'scripts/docker' label 'docker' args '-v /home/jenkins/cache:/home/jenkins/cache -v /home/jenkins/cache/conan/.conan:/home/jenkins/.conan' @@ -191,18 +197,18 @@ pipeline { sh 'git submodule sync' configure { cmakeOptions = - '-DOGS_CPU_ARCHITECTURE=generic ' + '-DOGS_CPU_ARCHITECTURE=generic ' + + '-DOGS_COVERAGE=ON ' config = 'Debug' } build { } - build { target = 'tests' } + build { target = 'testrunner_coverage_cobertura' } } } post { always { - xunit([ - GoogleTest(pattern: 'build/Tests/testrunner.xml') - ]) + xunit([GoogleTest(pattern: 'build/Tests/testrunner.xml')]) + cobertura coberturaReportFile: 'build/*_cobertura.xml' } } } @@ -319,7 +325,10 @@ pipeline { } build { target="tests" } build { target="ctest" } - build { log="build.log" } + build { + target="package" + log="build.log" + } } } post { @@ -361,17 +370,11 @@ pipeline { '-DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" ' } build { + target="package" log = "build.log" - cmd_args = '-j $(( `sysctl -n hw.ncpu` - 2 ))' - } - build { - target = 'tests' - cmd_args = '-j $(( `sysctl -n hw.ncpu` - 2 ))' - } - build { - target = 'ctest' - cmd_args = '-j $(( `sysctl -n hw.ncpu` - 2 ))' } + build { target = 'tests' } + build { target = 'ctest' } } } post { @@ -444,7 +447,7 @@ pipeline { } try { build { target = 'check-header' } - build { target = 'all' } + build { } } catch (Exception e) { } } @@ -488,7 +491,7 @@ pipeline { build { env = 'envinf1/cli.sh' target = 'install' - cmd_args = '-l 30' + } } } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 765ecf36d84e3d6207e9ddd3a3dbe1b3030ca90d..bd6f4f0e773ae87acfbf008216ebf0a7c2fe978c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -84,7 +84,7 @@ if(OGS_USE_PCH) endif() # Add make-target tests which runs the testrunner -if(IS_CI) +if(IS_CI AND NOT OGS_COVERAGE) set(TESTRUNNER_ADDITIONAL_ARGUMENTS ${TESTRUNNER_ADDITIONAL_ARGUMENTS} --gtest_shuffle --gtest_repeat=3) endif() diff --git a/scripts/cmake/Coverage.cmake b/scripts/cmake/Coverage.cmake index 70e15b298ae806c8485875f4b85791f4ca8376e4..338782428bc69e50848dfa5cdfdb3c1a82a1c5de 100644 --- a/scripts/cmake/Coverage.cmake +++ b/scripts/cmake/Coverage.cmake @@ -1,39 +1,35 @@ include(CodeCoverage) -APPEND_COVERAGE_COMPILER_FLAGS() +append_coverage_compiler_flags() -set(COVERAGE_EXCLUDES - '/gpfs0/*' - '/usr/*' - '${PROJECT_BINARY_DIR}/*' - '${PROJECT_SOURCE_DIR}/Tests/*' - '${PROJECT_SOURCE_DIR}/ThirdParty/*' +set(COVERAGE_GCOVR_EXCLUDES + ${PROJECT_BINARY_DIR}/.* + Applications/CLI/.* + ProcessLib/.* + .*Tests/.* + ThirdParty/.* ) if(LCOV_PATH AND GENHTML_PATH) - SETUP_TARGET_FOR_COVERAGE( + setup_target_for_coverage_lcov( NAME testrunner_coverage - EXECUTABLE testrunner -j ${PROCESSOR_COUNT} - DEPENDENCIES testrunner + EXECUTABLE ${CMAKE_COMMAND} --build . --target tests ) - SETUP_TARGET_FOR_COVERAGE( + setup_target_for_coverage_lcov( NAME ctest_coverage - EXECUTABLE ctest -E LARGE -j ${PROCESSOR_COUNT} - DEPENDENCIES ogs + EXECUTABLE ${CMAKE_COMMAND} --build . --target ctest-serial ) else() message(STATUS "No lcov coverage report generated because lcov or genhtml was not found.") endif() if(PYTHON_EXECUTABLE) - SETUP_TARGET_FOR_COVERAGE_COBERTURA( + setup_target_for_coverage_gcovr_xml( NAME testrunner_coverage_cobertura - EXECUTABLE testrunner -j ${PROCESSOR_COUNT} - DEPENDENCIES testrunner + EXECUTABLE ${CMAKE_COMMAND} --build . --target tests ) - SETUP_TARGET_FOR_COVERAGE_COBERTURA( + setup_target_for_coverage_gcovr_xml( NAME ctest_coverage_cobertura - EXECUTABLE ctest -E LARGE -j ${PROCESSOR_COUNT} - DEPENDENCIES ogs + EXECUTABLE ${CMAKE_COMMAND} --build . --target ctest-serial ) else() message(STATUS "No cobertura coverage report generated because Python executable was not found.")