diff --git a/.gitlab-ci.d/code-quality.yaml b/.gitlab-ci.d/code-quality.yaml index 5b5836d84..73a000acd 100644 --- a/.gitlab-ci.d/code-quality.yaml +++ b/.gitlab-ci.d/code-quality.yaml @@ -1,63 +1,63 @@ .code_quality_common: stage: code_quality allow_failure: true rules: - - if: '$CODE_QUALITY_DISABLED' + - if: "$CODE_QUALITY_DISABLED" when: never - - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH" .code_quality_gitlab_template: extends: - .code_quality_common image: docker:19.03.12 allow_failure: true services: - docker:19.03.12-dind variables: DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: "" CODE_QUALITY_IMAGE: "registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.24" needs: [] script: - export SOURCE_CODE=$PWD - | if ! docker info &>/dev/null; then if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then export DOCKER_HOST='tcp://localhost:2375' fi fi - | # this is required to avoid undesirable reset of Docker image ENV variables being set on build stage function propagate_env_vars() { CURRENT_ENV=$(printenv) for VAR_NAME; do echo $CURRENT_ENV | grep "${VAR_NAME}=" > /dev/null && echo "--env $VAR_NAME " done } - docker pull --quiet "$CODE_QUALITY_IMAGE" - | docker run --rm \ $(propagate_env_vars \ SOURCE_CODE \ TIMEOUT_SECONDS \ CODECLIMATE_DEBUG \ CODECLIMATE_DEV \ REPORT_STDOUT \ REPORT_FORMAT \ ENGINE_MEMORY_LIMIT_BYTES \ CODECLIMATE_PREFIX \ ) \ --volume "$PWD":/code \ --volume /var/run/docker.sock:/var/run/docker.sock \ "$CODE_QUALITY_IMAGE" /code .clang_tools: extends: - .code_quality_common - - .debian_testing_clang + - .debian_bullseye_clang before_script: - if [ 'x${CI_MERGE_REQUEST_ID}' != 'x' ]; then - - git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - - git diff --name-only $CI_COMMIT_SHA $CI_MERGE_REQUEST_TARGET_BRANCH_NAME > file_list - - FILE_LIST_ARG='-f file_list' + - git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME + - git diff --name-only $CI_COMMIT_SHA $CI_MERGE_REQUEST_TARGET_BRANCH_NAME > file_list + - FILE_LIST_ARG='-f file_list' - fi diff --git a/.gitlab-ci.d/images.yaml b/.gitlab-ci.d/images.yaml index 246e1a632..5970b3fce 100644 --- a/.gitlab-ci.d/images.yaml +++ b/.gitlab-ci.d/images.yaml @@ -1,109 +1,109 @@ .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 --no-cache -t registry.gitlab.com/akantu/akantu/${IMAGE_NAME} . - docker push registry.gitlab.com/akantu/akantu/${IMAGE_NAME} rules: - changes: - test/ci/${IMAGE_NAME}/* # ------------------------------------------------------------------------------ .cache_build: variables: CCACHE_BASEDIR: ${CI_PROJECT_DIR}/ CCACHE_DIR: ${CI_PROJECT_DIR}/.ccache CCACHE_MAXSIZE: 1Gi cache: key: ${output}_${BUILD_TYPE} 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_debian_bullseye: + image: registry.gitlab.com/akantu/akantu/debian:bullseye .image_ubuntu_lts: image: registry.gitlab.com/akantu/akantu/ubuntu:lts .image_manylinux: image: registry.gitlab.com/akantu/akantu/manylinux:2010_x86_64 # ------------------------------------------------------------------------------ .compiler_gcc: variables: CC: /usr/lib/ccache/gcc CXX: /usr/lib/ccache/g++ FC: gfortran GCOV_EXECUTABLE: gcov .compiler_clang: variables: CC: /usr/lib/ccache/clang CXX: /usr/lib/ccache/clang++ FC: gfortran GCOV_EXECUTABLE: llvm-cov gcov .build_coverage: variables: TEST_EXAMPLES: "FALSE" BUILD_TYPE: "Coverage" .build_release: variables: TEST_EXAMPLES: "TRUE" BUILD_TYPE: "Release" .build_valgrind: variables: TEST_EXAMPLES: "FALSE" BUILD_TYPE: "Valgrind" # ------------------------------------------------------------------------------ -.debian_testing_gcc: +.debian_bullseye_gcc: variables: - output: debian_testing_gcc + output: debian_bullseye_gcc extends: - .compiler_gcc - - .image_debian_testing + - .image_debian_bullseye - .cache_build -.debian_testing_clang: +.debian_bullseye_clang: variables: - output: debian_testing_clang + output: debian_bullseye_clang extends: - .compiler_clang - - .image_debian_testing + - .image_debian_bullseye - .cache_build .ubuntu_lts_gcc: variables: output: ubuntu_lts_gcc extends: - .compiler_gcc - .image_ubuntu_lts - .cache_build .manylinux_2010_x64_gcc: variables: output: manylinux_2010_x64_gcc extends: - .compiler_gcc - .image_manylinux - .cache_build diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cb7d307e1..cefbef361 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,375 +1,375 @@ stages: - configure - build_libs - build_tests - test - code_quality - deploy include: local: '.gitlab-ci.d/*.yaml' #------------------------------------------------------------------------------- # Rebuilding the docker images if needed #------------------------------------------------------------------------------- -docker build:debian-testing: +docker build:debian-bullseye: variables: - IMAGE_NAME: debian:testing + IMAGE_NAME: debian:bullseye extends: .docker_build docker build:ubuntu-lts: variables: IMAGE_NAME: ubuntu:lts extends: .docker_build docker build:manylinux: variables: IMAGE_NAME: manylinux:2010_x86_64 extends: .docker_build # ------------------------------------------------------------------------------ -# Debian testing compiled with GCC +# Debian bullseye compiled with GCC # ------------------------------------------------------------------------------ -configure:debian_testing_gcc: +configure:debian_bullseye_gcc: extends: - - .debian_testing_gcc + - .debian_bullseye_gcc - .build_coverage - .configure -build:debian_testing_gcc: +build:debian_bullseye_gcc: extends: - - .debian_testing_gcc + - .debian_bullseye_gcc - .build_coverage - .build_all needs: - - job: configure:debian_testing_gcc + - job: configure:debian_bullseye_gcc -#build_libs:debian_testing_gcc: +#build_libs:debian_bullseye_gcc: # extends: -# - .debian_testing_gcc +# - .debian_bullseye_gcc # - .build_coverage # - .build_libs # needs: -# - job: configure:debian_testing_gcc +# - job: configure:debian_bullseye_gcc -#build_tests:debian_testing_gcc: +#build_tests:debian_bullseye_gcc: # extends: -# - .debian_testing_gcc +# - .debian_bullseye_gcc # - .build_coverage # - .build_tests # needs: -# - job: build_libs:debian_testing_gcc +# - job: build_libs:debian_bullseye_gcc -test:debian_testing_gcc: +test:debian_bullseye_gcc: extends: - - .debian_testing_gcc + - .debian_bullseye_gcc - .build_coverage - .tests needs: - - job: build:debian_testing_gcc + - job: build:debian_bullseye_gcc # ------------------------------------------------------------------------------ -# Debian testing compiled with Clang +# Debian bullseye compiled with Clang # ------------------------------------------------------------------------------ -configure:debian_testing_clang: +configure:debian_bullseye_clang: extends: - - .debian_testing_clang + - .debian_bullseye_clang - .build_coverage - .configure -build:debian_testing_clang: +build:debian_bullseye_clang: extends: - - .debian_testing_clang + - .debian_bullseye_clang - .build_coverage - .build_all needs: - - job: configure:debian_testing_clang + - job: configure:debian_bullseye_clang -#build_libs:debian_testing_clang: +#build_libs:debian_bullseye_clang: # extends: -# - .debian_testing_clang +# - .debian_bullseye_clang # - .build_coverage # - .build_libs # needs: -# - job: configure:debian_testing_clang +# - job: configure:debian_bullseye_clang -#build_tests:debian_testing_clang: +#build_tests:debian_bullseye_clang: # extends: -# - .debian_testing_clang +# - .debian_bullseye_clang # - .build_coverage # - .build_tests # needs: -# - job: build_libs:debian_testing_clang +# - job: build_libs:debian_bullseye_clang -test:debian_testing_clang: +test:debian_bullseye_clang: extends: - - .debian_testing_clang + - .debian_bullseye_clang - .build_coverage - .tests coverage: '/^lines: (\d+\.\d+\%)/' needs: - - job: build:debian_testing_clang + - job: build:debian_bullseye_clang # ------------------------------------------------------------------------------ # Ubuntu LTS compiled with GCC # ------------------------------------------------------------------------------ configure:ubuntu_lts_gcc: extends: - .ubuntu_lts_gcc - .build_release - .configure build:ubuntu_lts_gcc: extends: - .ubuntu_lts_gcc - .build_release - .build_all needs: - job: configure:ubuntu_lts_gcc test:ubuntu_lts_gcc: extends: - .ubuntu_lts_gcc - .build_release - .tests needs: - job: build:ubuntu_lts_gcc # ------------------------------------------------------------------------------ -# Debian testing compiled with GCC tested with valgrind +# Debian bullseye compiled with GCC tested with valgrind # ------------------------------------------------------------------------------ configure:ubuntu_lts_gcc_valgrind: extends: - .ubuntu_lts_gcc - .build_valgrind - .configure build:ubuntu_lts_gcc_valgrind: extends: - .ubuntu_lts_gcc - .build_valgrind - .build_all needs: - job: configure:ubuntu_lts_gcc_valgrind test:ubuntu_lts_gcc_valgrind: extends: - .ubuntu_lts_gcc - .build_valgrind - .tests needs: - job: build:ubuntu_lts_gcc_valgrind # ------------------------------------------------------------------------------ # Manylinux to build python packages # ------------------------------------------------------------------------------ configure:python_package: stage: configure extends: - .manylinux_2010_x64_gcc - .build_release script: # create the build folder - cmake -E make_directory build - cd build # Variables for cmake - export CMAKE_PREFIX_PATH=/softs/view - export BOOST_ROOT=/softs/view # Configure in sequential and without tests or examples - cmake -DAKANTU_COHESIVE_ELEMENT:BOOL=TRUE -DAKANTU_IMPLICIT:BOOL=TRUE -DAKANTU_PARALLEL:BOOL=FALSE -DAKANTU_STRUCTURAL_MECHANICS:BOOL=TRUE -DAKANTU_HEAT_TRANSFER:BOOL=TRUE -DAKANTU_DAMAGE_NON_LOCAL:BOOL=TRUE -DAKANTU_PHASE_FIELD:BOOL=TRUE -DAKANTU_PYTHON_INTERFACE:BOOL=FALSE -DAKANTU_CONTACT_MECHANICS:BOOL=TRUE -DAKANTU_EXAMPLES:BOOL=FALSE -DAKANTU_TESTS:BOOL=FALSE -DMUMPS_DETECT_DEBUG:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=${CI_PROJECT_DIR}/install -DCMAKE_BUILD_TYPE:STRING=${BUILD_TYPE} .. artifacts: when: on_success paths: - build/ expire_in: 10h build_akantu:python_package: extends: - .build_libs - .build_release - .manylinux_2010_x64_gcc script: stage: build_libs script: - cmake --build build --target akantu -j1 - cmake --install build artifacts: when: on_success paths: - install/ expire_in: 10h needs: - job: configure:python_package build_pip:python_package: stage: build_tests extends: - .build_release - .manylinux_2010_x64_gcc script: - export CI_AKANTU_INSTALL_PREFIX=${CI_PROJECT_DIR}/install - export CMAKE_PREFIX_PATH=/softs/view:${CI_AKANTU_INSTALL_PREFIX} - test/ci/make-wheels.sh needs: - job: build_akantu:python_package artifacts: when: on_success paths: - wheelhouse expire_in: 10h test:python_package: stage: test image: python:3.8 needs: - job: build_pip:python_package script: - pip install akantu -f wheelhouse - python -c "import akantu" - cd examples/python/dynamics/ - apt update && apt install -y gmsh - gmsh -2 bar.geo - python ./dynamics.py package:python_gitlab: stage: deploy image: python:latest script: - pip install twine - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python3 -m twine upload --repository-url https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi wheelhouse/* needs: - job: build_pip:python_package only: - master package:python_pypi: stage: deploy image: python:latest script: - pip install twine - TWINE_PASSWORD=${PYPI_TOKEN} TWINE_USERNAME=__token__ python3 -m twine upload --verbose wheelhouse/* needs: - job: build_pip:python_package only: - tags # ------------------------------------------------------------------------------ # Code Quality # ------------------------------------------------------------------------------ cq:code_quality: extends: - .code_quality_gitlab_template needs: - - job: build:debian_testing_clang + - job: build:debian_bullseye_clang artifacts: paths: - gl-code-quality-report.json cq:clang_tidy: extends: - .clang_tools script: - test/ci/scripts/cq -x third-party -x extra-packages -x pybind11 -x test ${FILE_LIST_ARG} clang-tidy -p ${CI_PROJECT_DIR}/build > gl-clang-tidy-report.json needs: - - job: build:debian_testing_clang + - job: build:debian_bullseye_clang artifacts: paths: - gl-clang-tidy-report.json cq:clang_format: extends: - .clang_tools script: - test/ci/scripts/cq -x third-party -x extra-packages clang-format -p ${CI_PROJECT_DIR}/build > gl-clang-format-report.json needs: - - job: build:debian_testing_clang + - job: build:debian_bullseye_clang artifacts: paths: - gl-clang-format-report.json cq:compilation_warnings: stage: code_quality image: python:latest script: - pip install warning-parser termcolor Click - ls build-*-err.log - test/ci/scripts/cq -x third-party -x extra-packages warnings build-*-err.log > gl-warnings-report.json needs: - - job: build:debian_testing_clang - - job: build:debian_testing_gcc + - job: build:debian_bullseye_clang + - job: build:debian_bullseye_gcc - job: build:ubuntu_lts_gcc artifacts: paths: - gl-warnings-report.json cq:merge_code_quality: stage: deploy extends: - - .debian_testing_clang + - .debian_bullseye_clang script: - jq -Ms '[.[][]]' gl-*-report.json | tee gl-codequality.json | jq -C needs: - job: cq:code_quality - job: cq:clang_tidy - job: cq:clang_format - job: cq:compilation_warnings artifacts: paths: - gl-codequality.json artifacts: reports: codequality: [gl-codequality.json] # ------------------------------------------------------------------------------ # Deploy pages # ------------------------------------------------------------------------------ pages: stage: deploy extends: - - .debian_testing_gcc + - .debian_bullseye_gcc script: - cd build - cmake -DAKANTU_DOCUMENTATION=ON .. - cmake --build . -t sphinx-doc - mv doc/dev-doc/html ../public needs: - - job: build:debian_testing_gcc + - job: build:debian_bullseye_gcc artifacts: paths: - public only: - master diff --git a/test/ci/debian:testing/.openmpi/mca-params.conf b/test/ci/debian:bullseye/.openmpi/mca-params.conf similarity index 100% rename from test/ci/debian:testing/.openmpi/mca-params.conf rename to test/ci/debian:bullseye/.openmpi/mca-params.conf diff --git a/test/ci/debian:testing/Dockerfile b/test/ci/debian:bullseye/Dockerfile similarity index 75% rename from test/ci/debian:testing/Dockerfile rename to test/ci/debian:bullseye/Dockerfile index 71ee37a7e..85dc5c6b6 100644 --- a/test/ci/debian:testing/Dockerfile +++ b/test/ci/debian:bullseye/Dockerfile @@ -1,43 +1,38 @@ -FROM debian:testing +FROM debian:bullseye MAINTAINER Nicolas Richart -RUN apt-get -o Acquire::AllowInsecureRepositories=true update && \ - apt-get -qq -y --allow-unauthenticated -o Acquire::AllowInsecureRepositories=true install gnupg dirmngr - -RUN gpg --no-default-keyring --keyring /usr/share/keyrings/extra.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 648ACFD622F3D138 0E98404D386FA1D9 - # library dependencies RUN apt-get -qq update && apt-get -qq -y install \ g++ gfortran clang cmake \ openmpi-bin libmumps-dev libscotch-dev \ libboost-dev libopenblas-dev \ python3 python3-dev python3-numpy python3-scipy python3-mpi4py \ && rm -rf /var/lib/apt/lists/* # for documentation RUN apt-get -qq update && apt-get -qq -y install \ python3-sphinx \ python3-sphinxcontrib.bibtex \ python3-sphinx-rtd-theme \ python3-breathe \ python3-git python3-jinja2 \ doxygen graphviz \ && rm -rf /var/lib/apt/lists/* # for ci RUN apt-get -qq update && apt-get -qq -y install \ gmsh python3-pytest python3-click python3-termcolor \ ccache clang-format python3-flake8 python3-pip clang-tidy \ curl git xsltproc jq \ gcovr llvm binutils \ ninja-build \ && rm -rf /var/lib/apt/lists/* RUN pip3 install warning_parser COPY .openmpi /root/.openmpi # for debug RUN apt-get -qq update && apt-get -qq -y install \ gdb valgrind \ && rm -rf /var/lib/apt/lists/*