diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3178068f5..458fbdbda 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,322 +1,321 @@ stages: - configure - build - check-warnings - test - deploy .docker_build: image: 'docker:19.03.11' stage: .pre services: - docker:19.03.11-dind variables: # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled DOCKER_HOST: tcp://docker:2376 DOCKER_TLS_CERTDIR: "/certs" before_script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY script: - cd test/ci/${IMAGE_NAME}/ - docker build -t registry.gitlab.com/akantu/akantu/${IMAGE_NAME} . - docker push registry.gitlab.com/akantu/akantu/${IMAGE_NAME} docker build:debian-testing: variables: IMAGE_NAME: debian:testing extends: .docker_build rules: - changes: - test/ci/debian:testing/Dockerfile docker build:ubuntu-lts: variables: IMAGE_NAME: ubuntu:lts extends: .docker_build rules: - changes: - test/ci/ubuntu:lts/Dockerfile .configure: stage: configure except: - tags variables: BLA_VENDOR: 'Generic' script: - cmake -E make_directory build - cd build - cmake -DAKANTU_COHESIVE_ELEMENT:BOOL=TRUE -DAKANTU_IMPLICIT:BOOL=TRUE -DAKANTU_PARALLEL:BOOL=TRUE -DAKANTU_STRUCTURAL_MECHANICS:BOOL=TRUE -DAKANTU_HEAT_TRANSFER:BOOL=TRUE -DAKANTU_DAMAGE_NON_LOCAL:BOOL=TRUE -DAKANTU_PYTHON_INTERFACE:BOOL=TRUE -DAKANTU_EXAMPLES:BOOL=TRUE -DAKANTU_BUILD_ALL_EXAMPLES:BOOL=TRUE -DAKANTU_TEST_EXAMPLES:BOOL=FALSE -DAKANTU_TESTS:BOOL=TRUE -DAKANTU_RUN_IN_DOCKER:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Coverage .. - cp compile_commmands.json .. artifacts: when: on_success paths: - build - compile_commands.json expire_in: 10h .build: stage: build script: - cmake --build build/src > >(tee -a ${output}-out.log) 2> >(tee -a ${output}-err.log >&2) - cmake --build build/python > >(tee -a ${output}-out.log) 2> >(tee -a ${output}-err.log >&2) - cmake --build build/test/ > >(tee -a ${output}-out.log) 2> >(tee -a ${output}-err.log >&2) - cmake --build build/examples > >(tee -a ${output}-out.log) 2> >(tee -a ${output}-err.log >&2) artifacts: when: on_success paths: - build/ #- ${output}-out.log - ${output}-err.log - compile_commands.json expire_in: 10h .tests: stage: test script: - cd build - ctest -T test --no-compress-output --timeout 1800 after_script: - cd build - tag=$(head -n 1 < Testing/TAG) - if [ -e Testing/${tag}/Test.xml ]; then - xsltproc -o ./juint.xml ${CI_PROJECT_DIR}/test/ci/ctest2junit.xsl Testing/${tag}/Test.xml; - fi - gcovr --xml --output coverage.xml --object-directory ${CI_PROJECT_DIR}/build --root ${CI_PROJECT_DIR} -s || true artifacts: when: always paths: - build/juint.xml - build/coverage.xml reports: junit: - build/juint.xml cobertura: - build/coverage.xml .analyse_build: stage: check-warnings script: - if [[ $(cat ${output}-err.log | grep warning -i) ]]; then - cat ${output}-err.log; - exit 1; - fi allow_failure: true artifacts: when: on_failure paths: - "$output-err.log" # ------------------------------------------------------------------------------ .cache_build: variables: CCACHE_BASEDIRE: ${CI_PROJECT_DIR}/build CCACHE_DIR: ${CI_PROJECT_DIR}/.ccache CCACHE_NOHASHDIR: 1 CCACHE_COMPILERCHECK: content cache: key: ${output} policy: pull-push paths: - .ccache/ - third-party/google-test - third-party/pybind11 before_script: - ccache --zero-stats || true after_script: - ccache --show-stats || true # ------------------------------------------------------------------------------ .image_debian_testing: image: registry.gitlab.com/akantu/akantu/debian:testing .image_ubuntu_lts: image: registry.gitlab.com/akantu/akantu/ubuntu:lts # ------------------------------------------------------------------------------ .compiler_gcc: variables: CC: /usr/lib/ccache/gcc CXX: /usr/lib/ccache/g++ FC: gfortran .compiler_clang: variables: CC: /usr/lib/ccache/clang CXX: /usr/lib/ccache/clang++ FC: gfortran # ------------------------------------------------------------------------------ .debian_testing_gcc: variables: output: debian_testing_gcc extends: - .compiler_gcc - .image_debian_testing - .cache_build .debian_testing_clang: variables: output: debian_testing_clang extends: - .compiler_clang - .image_debian_testing - .cache_build .ubuntu_lts_gcc: variables: output: ubuntu_lts_gcc extends: - .compiler_gcc - .image_ubuntu_lts - .cache_build # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ configure:debian_testing_gcc: extends: - .debian_testing_gcc - .configure cache: policy: pull-push build:debian_testing_gcc: extends: - .debian_testing_gcc - .build dependencies: - configure:debian_testing_gcc test:debian_testing_gcc: extends: - .debian_testing_gcc - .tests dependencies: - build:debian_testing_gcc analyse_build:debian_testing_gcc: extends: - .debian_testing_gcc - .analyse_build dependencies: - build:debian_testing_gcc # ------------------------------------------------------------------------------ configure:debian_testing_clang: extends: - .debian_testing_clang - .configure cache: policy: pull-push build:debian_testing_clang: extends: - .debian_testing_clang - .build dependencies: - configure:debian_testing_clang test:debian_testing_clang: extends: - .debian_testing_clang - .tests dependencies: - build:debian_testing_clang analyse_build:debian_testing_clang: extends: - .debian_testing_clang - .analyse_build dependencies: - build:debian_testing_clang # ------------------------------------------------------------------------------ configure:ubuntu_lts_gcc: extends: - .ubuntu_lts_gcc - .configure cache: policy: pull-push build:ubuntu_lts_gcc: extends: - .ubuntu_lts_gcc - .build dependencies: - configure:ubuntu_lts_gcc analyse_build:ubuntu_lts_gcc: extends: - .ubuntu_lts_gcc - .analyse_build dependencies: - build:ubuntu_lts_gcc test:ubuntu_lts_gcc: extends: - .ubuntu_lts_gcc - .tests dependencies: - build:ubuntu_lts_gcc # ------------------------------------------------------------------------------ include: - template: Code-Quality.gitlab-ci.yml code_quality: dependencies: - build:debian_testing_clang artifacts: paths: [gl-code-quality-report.json] code_quality_clang_tidy: dependencies: - build:debian_testing_clang stage: test script: - cmake --build build --target clang-tidy-all > >(tee -a clang-tidy-all-out.log) 2> >(tee -a clang-tidy-all-err.log >&2) - python3 ./test/ci/scripts/clang-tidy2code-quality.py artifacts: - when: on_success paths: - clang-tidy-all-err.log - clang-tidy-all-out.log - - code-quality-clang.json expire_in: 10h artifacts: + when: on_success reports: codequality: - code-quality-clang.json # ------------------------------------------------------------------------------ pages: stage: deploy extends: - .debian_testing_gcc script: - cd build - cmake -DAKANTU_DOCUMENTATION_DEVELOPER_MANUAL=ON .. - cmake --build . -t sphinx-doc - mv doc/dev-doc/html ../public dependencies: - build:debian_testing_gcc artifacts: paths: - public only: - features/doc diff --git a/cmake/AkantuExtraCompilationProfiles.cmake b/cmake/AkantuExtraCompilationProfiles.cmake index e8095cb09..bc05decac 100644 --- a/cmake/AkantuExtraCompilationProfiles.cmake +++ b/cmake/AkantuExtraCompilationProfiles.cmake @@ -1,93 +1,89 @@ #Profiling set(_profiling "-g -ggdb3 -pg -DNDEBUG -DAKANTU_NDEBUG -O2") set(CMAKE_CXX_FLAGS_PROFILING ${_profiling} CACHE STRING "Flags used by the compiler during profiling builds") set(CMAKE_C_FLAGS_PROFILING ${_profiling} CACHE STRING "Flags used by the compiler during profiling builds") set(CMAKE_Fortran_FLAGS_PROFILING ${_profiling} CACHE STRING "Flags used by the compiler during profiling builds") set(CMAKE_EXE_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds") set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds") mark_as_advanced( CMAKE_CXX_FLAGS_PROFILING CMAKE_C_FLAGS_PROFILING CMAKE_Fortran_FLAGS_PROFILING CMAKE_EXE_LINKER_FLAGS_PROFILING CMAKE_SHARED_LINKER_FLAGS_PROFILING ) +set(_coverage "-g -ggdb3 -DNDEBUG -DAKANTU_NDEBUG -O2 --coverage") +set(CMAKE_CXX_FLAGS_COVERAGE ${_coverage} + CACHE STRING "Flags used by the compiler during profiling builds" FORCE) +set(CMAKE_C_FLAGS_COVERAGE ${_coverage} + CACHE STRING "Flags used by the compiler during profiling builds" FORCE) +set(CMAKE_Fortran_FLAGS_COVERAGE ${_coverage} + CACHE STRING "Flags used by the compiler during profiling builds" FORCE) +set(CMAKE_SHARED_LINLER_FLAGS_COVERAGE ${_coverage} + CACHE STRING "Flags used by the compiler during profiling builds" FORCE) +set(CMAKE_EXE_LINKER_FLAGS_COVERAGE ${_coverage} + CACHE STRING "Flags used by the linker during sanitizing builds" FORCE) + +mark_as_advanced( + CMAKE_CXX_FLAGS_COVERAGE + CMAKE_C_FLAGS_COVERAGE + CMAKE_Fortran_FLAGS_COVERAGE + CMAKE_SHARED_LINKER_FLAGS_SANITIZEMEMORY + CMAKE_EXE_LINKER_FLAGS_SANITIZEMEMORY + ) + # Sanitize the code if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.2") OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(_sanitize "-g -ggdb3 -O2 -fsanitize=address -fsanitize=leak -fsanitize=undefined -fno-omit-frame-pointer -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/cmake/sanitize-blacklist.txt") set(CMAKE_CXX_FLAGS_SANITIZE ${_sanitize} CACHE STRING "Flags used by the compiler during sanitizing builds") set(CMAKE_C_FLAGS_SANITIZE ${_sanitize} CACHE STRING "Flags used by the compiler during sanitizing builds") set(CMAKE_Fortran_FLAGS_SANITIZE ${_sanitize} CACHE STRING "Flags used by the compiler during sanitizing builds") set(CMAKE_EXE_LINKER_FLAGS_SANITIZE ${_sanitize} CACHE STRING "Flags used by the linker during sanitizing builds") set(CMAKE_SHARED_LINKER_FLAGS_SANITIZE ${_sanitize} CACHE STRING "Flags used by the linker during sanitizing builds") mark_as_advanced( CMAKE_CXX_FLAGS_SANITIZE CMAKE_C_FLAGS_SANITIZE CMAKE_Fortran_FLAGS_SANITIZE CMAKE_SHARED_LINKER_FLAGS_SANITIZE CMAKE_EXE_LINKER_FLAGS_SANITIZE ) endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(_sanitize "-g -ggdb3 -O2 -fPIE -fsanitize=memory -fsanitize-memory-track-origins -fsanitize-recover=all -fno-omit-frame-pointer -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/cmake/sanitize-blacklist.txt") set(CMAKE_CXX_FLAGS_SANITIZEMEMORY ${_sanitize} CACHE STRING "Flags used by the compiler during sanitizing builds") set(CMAKE_C_FLAGS_SANITIZEMEMORY ${_sanitize} CACHE STRING "Flags used by the compiler during sanitizing builds") set(CMAKE_Fortran_FLAGS_SANITIZEMEMORY ${_sanitize} CACHE STRING "Flags used by the compiler during sanitizing builds") set(CMAKE_EXE_LINKER_FLAGS_SANITIZEMEMORY ${_sanitize} CACHE STRING "Flags used by the linker during sanitizing builds") set(CMAKE_SHARED_LINKER_FLAGS_SANITIZEMEMORY ${_sanitize} CACHE STRING "Flags used by the linker during sanitizing builds") mark_as_advanced( CMAKE_CXX_FLAGS_SANITIZEMEMORY CMAKE_C_FLAGS_SANITIZEMEMORY CMAKE_Fortran_FLAGS_SANITIZEMEMORY CMAKE_SHARED_LINKER_FLAGS_SANITIZEMEMORY CMAKE_EXE_LINKER_FLAGS_SANITIZEMEMORY ) endif() - -find_program(GCOV_EXECUTABLE gcov) -if (GCOV_EXECUTABLE) - set(_coverage "-g -ggdb3 -DNDEBUG -DAKANTU_NDEBUG -O2 --coverage") - set(CMAKE_CXX_FLAGS_COVERAGE ${_coverage} - CACHE STRING "Flags used by the compiler during profiling builds") - set(CMAKE_C_FLAGS_COVERAGE ${_coverage} - CACHE STRING "Flags used by the compiler during profiling builds") - set(CMAKE_Fortran_FLAGS_COVERAGE ${_coverage} - CACHE STRING "Flags used by the compiler during profiling builds") - set(CMAKE_SHARED_LINLER_FLAGS_COVERAGE ${_coverage} - CACHE STRING "Flags used by the compiler during profiling builds") - set(CMAKE_EXE_LINKER_FLAGS_COVERAGE ${_coverage} - CACHE STRING "Flags used by the linker during sanitizing builds") - - mark_as_advanced( - CMAKE_CXX_FLAGS_COVERAGE - CMAKE_C_FLAGS_COVERAGE - CMAKE_Fortran_FLAGS_COVERAGE - CMAKE_SHARED_LINKER_FLAGS_SANITIZEMEMORY - CMAKE_EXE_LINKER_FLAGS_SANITIZEMEMORY - ) -endif()