diff --git a/CMakeLists.txt b/CMakeLists.txt index 3272d7d..eafb030 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,69 +1,69 @@ cmake_minimum_required(VERSION 3.10) project(AkantuIterators) # ------------------------------------------------------------------------------ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(BUILD_SHARED_LIBS ON) if (NOT AKANTU_ITERATORS_PYTHON_MAJOR_VERSION) set(AKANTU_ITERATORS_PYTHON_MAJOR_VERSION 3) endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) include(AkantuIteratorsTools) # ------------------------------------------------------------------------------ set(AKANTU_ITERATORS_PUBLIC_HDRS aka_compatibilty_with_cpp_standard.hh aka_iterators.hh aka_static_if.hh aka_tuple_tools.hh ) add_library(akantu_iterators INTERFACE) target_include_directories(akantu_iterators INTERFACE $ ) # small trick for build includes in public set_property(TARGET akantu_iterators APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $) set_property(TARGET akantu_iterators PROPERTY INTERFACE_PUBLIC_HEADER ${AKANTU_ITERATORS_PUBLIC_HDRS}) set_target_properties(akantu_iterators PROPERTIES INTERFACE_CXX_STANDARD 14 ) # ------------------------------------------------------------------------------ -option(AKANTU_ITERATORS_TESTS ON) +option(AKANTU_ITERATORS_TESTS "Activating tests" ON) mark_as_advanced(AKANTU_ITERATORS_TESTS) if(AKANTU_ITERATORS_TESTS) enable_testing() add_external_package(GTest) add_subdirectory(test) endif() # ------------------------------------------------------------------------------ if(NOT AKANTU_ITERATORS_TARGETS_EXPORT) set(AKANTU_ITERATORS_TARGETS_EXPORT AkantuIteratorsTargets) endif() install(TARGETS akantu_iterators EXPORT ${AKANTU_ITERATORS_TARGETS_EXPORT} PUBLIC_HEADER DESTINATION include/akantu_iterators/ COMPONENT dev ) if("${AKANTU_ITERATORS_TARGETS_EXPORT}" STREQUAL "AkantuIteratorsTargets") install(EXPORT AkantuIteratorsTargets DESTINATION share/cmake/${PROJECT_NAME} COMPONENT dev) #Export for build tree export(EXPORT AkantuIteratorsTargets FILE "${CMAKE_CURRENT_BINARY_DIR}/AkantuIteratorsTargets.cmake") export(PACKAGE AkantuIterators) endif() diff --git a/Jenkinsfile b/Jenkinsfile index c8162af..4f1dbd5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,127 +1,127 @@ pipeline { parameters {string(defaultValue: '', description: 'api-token', name: 'API_TOKEN') string(defaultValue: '', description: 'buildable phid', name: 'BUILD_TARGET_PHID') string(defaultValue: '', description: 'Commit id', name: 'COMMIT_ID') string(defaultValue: '', description: 'Diff id', name: 'DIFF_ID') string(defaultValue: 'PHID-PROJ-5eqyu6ooyjktagbhf473', description: 'ID of the project', name: 'PROJECT_ID') } options { disableConcurrentBuilds() } environment { PHABRICATOR_HOST = 'https://c4science.ch/api/' PYTHONPATH = sh returnStdout: true, script: 'echo ${WORKSPACE}/test/ci/script/' } agent { dockerfile { filename 'Dockerfile' dir 'test/ci' additionalBuildArgs '--tag akantu-iterators' } } stages { stage('Checkout proper commit') { steps { checkout scm: [$class: 'GitSCM', branches: [[name: "${COMMIT_ID}" ]] ], changelog: true } } stage('Lint') { steps { sh """ arc lint --output json --rev HEAD^ | jq . -srM | tee lint.json ./test/ci/scripts/hbm send-arc-lint -f lint.json """ } } stage('Configure') { steps { sh """#!/bin/bash set -o pipefail mkdir -p build cd build - cmake .. | tee configure.txt + cmake -DAKANTU_ITERATORS_TESTS:BOOL=ON .. | tee configure.txt """ } post { failure { uploadArtifact('configure.txt', 'Configure') deleteDir() } } } stage('Compile tests') { steps { sh '''#!/bin/bash set -o pipefail - + make -C build | tee compilation_test.txt ''' } post { failure { uploadArtifact('compilation_test.txt', 'Compilation_Tests') } } } stage('Tests') { steps { sh ''' cd build/ ctest -T test --no-compress-output || true tag=$(head -n 1 < Testing/TAG) if [ -e Testing/${tag}/Test.xml ]; then cp Testing/${tag}/Test.xml ../CTestResults.xml fi ''' } } } post { always { createArtifact("./CTestResults.xml") step([$class: 'XUnitBuilder', thresholds: [ [$class: 'SkippedThreshold', failureThreshold: '0'], [$class: 'FailedThreshold', failureThreshold: '0']], tools: [ [$class: 'CTestType', pattern: 'CTestResults.xml', skipNoTestFiles: true] ]]) } success { passed() } failure { failed() } } } def failed() { sh "./test/ci/scripts/hbm failed" } def passed() { sh "./test/ci/scripts/hbm passed" } def createArtifact(filename) { sh "./test/ci/scripts/hbm send-uri -k 'Jenkins URI' -u ${BUILD_URL} -l 'View Jenkins result'" sh "./test/ci/scripts/hbm send-ctest-results -f ${filename}" } def uploadArtifact(artifact, name) { sh "./test/ci/scripts/hbm upload-file -f ${artifact} -n \"${name}\" -v ${PROJECT_ID}" }