diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9de0283d17731ab7a7e78f104084967445587a76..691bef16fc20767e4d6ed9dddbef58e126044a91 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,12 +46,12 @@ workflow: - if: '$CI_COMMIT_BRANCH' stages: - # - precheck + - precheck - prepare - build - # - report - # - deploy - # - docker + - report + - deploy + - docker .general: retry: @@ -115,110 +115,110 @@ stages: - build/*/*/*/*.cmake #-------------------------- precheck job --------------------------------------- -# fast-build: -# extends: .common -# only: -# - merge_requests -# - branches -# stage: precheck -# image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-native-develop-headless:20.04 -# before_script: -# - export GIT_LFS_SKIP_SMUDGE=1 -# - git checkout -f -q $CI_COMMIT_SHA -# script: -# - ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-20.04-fast -# - ccache -s +fast-build: + extends: .common + only: + - merge_requests + - branches + stage: precheck + image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-native-develop-headless:20.04 + before_script: + - export GIT_LFS_SKIP_SMUDGE=1 + - git checkout -f -q $CI_COMMIT_SHA + script: + - ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-20.04-fast + - ccache -s -# legal-check: -# extends: .common -# only: -# - merge_requests -# - develop -# - /^release-[0-9]+\.[0-9]+$/ -# stage: precheck -# image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7 -# variables: -# GIT_DEPTH: "" -# allow_failure: true -# script: -# - ./CI/contributors_check.sh -# - ./CI/headers_check.py -# after_script: [] +legal-check: + extends: .common + only: + - merge_requests + - develop + - /^release-[0-9]+\.[0-9]+$/ + stage: precheck + image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7 + variables: + GIT_DEPTH: "" + allow_failure: true + script: + - ./CI/contributors_check.sh + - ./CI/headers_check.py + after_script: [] #------------------------- prepare & build jobs -------------------------------- -## Ubuntu superbuild -# ubuntu-20-prepare: -# extends: .common-prepare -# image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base-headless:20.04 -# script: -# - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-full -DOTB_FULL_BUILD:BOOL=ON +# Ubuntu superbuild +ubuntu-20-prepare: + extends: .common-prepare + image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base-headless:20.04 + script: + - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-full -DOTB_FULL_BUILD:BOOL=ON -# ubuntu-22-prepare: -# extends: .common-prepare -# image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:22.04 -# script: -# - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-full +ubuntu-22-prepare: + extends: .common-prepare + image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:22.04 + script: + - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-full -# ubuntu-20-build: -# extends: .common-build -# image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base-headless:20.04 -# script: -# - ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-xdk-full -# - mv build/CookBook-*-html.tar.gz . || true -# - mv build/Documentation/Cookbook/latex/CookBook-*.pdf . || true -# - mv build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2 . || true -# - ctest -V -S CI/superbuild_packaging.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-xdk-full -DPACKAGE_BY_MODULE:BOOL=ON -# - ctest -V -S CI/superbuild_packaging.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-xdk-full -DPACKAGE_BY_MODULE:BOOL=OFF -# - mv build_packages/OTB-*.tar.gz . || true -# needs: -# - job: ubuntu-20-prepare -# artifacts: true +ubuntu-20-build: + extends: .common-build + image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base-headless:20.04 + script: + - ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-xdk-full + - mv build/CookBook-*-html.tar.gz . || true + - mv build/Documentation/Cookbook/latex/CookBook-*.pdf . || true + - mv build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2 . || true + - ctest -V -S CI/superbuild_packaging.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-xdk-full -DPACKAGE_BY_MODULE:BOOL=ON + - ctest -V -S CI/superbuild_packaging.cmake -DIMAGE_NAME:string=ubuntu-20.04-llvm-xdk-full -DPACKAGE_BY_MODULE:BOOL=OFF + - mv build_packages/OTB-*.tar.gz . || true + needs: + - job: ubuntu-20-prepare + artifacts: true -# # Ubuntu 22 build needed for gdal bindings with python 3.10. We package the compiled bindings for python 3.10, this package will be downloaded and extracted automatically when -# # a user lauches the otbenv profile after unpacking the official archive for the first time (which contains bindings for ubuntu 20 and python 3.8 initially) -# ubuntu-22-gdal-bindings: -# extends: .common-build -# image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:22.04 -# only: -# changes: -# - SuperBuild/CMake/External_gdal.cmake -# refs: -# - /^release-[0-9]+\.[0-9]+$/ -# script: -# - ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=ubuntu-22.04-llvm-xdk-full -Dci_skip_testing:BOOL=ON -# - find xdk/lib/python3/dist-packages/osgeo/ -type f -name "*.so" -printf "%P\n" | tar -czf OTB-GDAL-bindings-py310.tar.gz --no-recursion -C xdk/lib/python3/dist-packages/osgeo -T - -# needs: -# - job: ubuntu-22-prepare -# artifacts: true +# Ubuntu 22 build needed for gdal bindings with python 3.10. We package the compiled bindings for python 3.10, this package will be downloaded and extracted automatically when +# a user lauches the otbenv profile after unpacking the official archive for the first time (which contains bindings for ubuntu 20 and python 3.8 initially) +ubuntu-22-gdal-bindings: + extends: .common-build + image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:22.04 + only: + changes: + - SuperBuild/CMake/External_gdal.cmake + refs: + - /^release-[0-9]+\.[0-9]+$/ + script: + - ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=ubuntu-22.04-llvm-xdk-full -Dci_skip_testing:BOOL=ON + - find xdk/lib/python3/dist-packages/osgeo/ -type f -name "*.so" -printf "%P\n" | tar -czf OTB-GDAL-bindings-py310.tar.gz --no-recursion -C xdk/lib/python3/dist-packages/osgeo -T - + needs: + - job: ubuntu-22-prepare + artifacts: true -# ## RedHat superbuild -# redhat-prepare: -# extends: .common-prepare -# image: $BUILD_IMAGE_REGISTRY/otb-redhat-superbuild-base:8 -# script: -# - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=redhat-8-gcc -DOTB_FULL_BUILD:BOOL=ON +## RedHat superbuild +redhat-prepare: + extends: .common-prepare + image: $BUILD_IMAGE_REGISTRY/otb-redhat-superbuild-base:8 + script: + - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=redhat-8-gcc -DOTB_FULL_BUILD:BOOL=ON -# redhat-build: -# extends: .common-build -# image: $BUILD_IMAGE_REGISTRY/otb-redhat-superbuild-base:8 -# script: -# - ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=redhat-8-gcc -# - ctest -V -S CI/superbuild_packaging.cmake -DIMAGE_NAME:string=redhat-8-gcc -DPACKAGE_BY_MODULE:BOOL=ON -# - ctest -V -S CI/superbuild_packaging.cmake -DIMAGE_NAME:string=redhat-8-gcc -DPACKAGE_BY_MODULE:BOOL=OFF -# # change package names to RedHat -# - | -# # use "find" to select only packages that matters -# rh_packages=$(find build_packages -type f -name "OTB*Linux*.tar.gz") -# for pkg in $rh_packages -# do -# new_name=$(sed "s/-Linux/-Linux_RedHat/g" <<< "$pkg") -# mv $pkg $new_name -# done -# - mv build_packages/OTB-*.tar.gz . || true -# needs: -# - job: redhat-prepare -# artifacts: true +redhat-build: + extends: .common-build + image: $BUILD_IMAGE_REGISTRY/otb-redhat-superbuild-base:8 + script: + - ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=redhat-8-gcc + - ctest -V -S CI/superbuild_packaging.cmake -DIMAGE_NAME:string=redhat-8-gcc -DPACKAGE_BY_MODULE:BOOL=ON + - ctest -V -S CI/superbuild_packaging.cmake -DIMAGE_NAME:string=redhat-8-gcc -DPACKAGE_BY_MODULE:BOOL=OFF + # change package names to RedHat + - | + # use "find" to select only packages that matters + rh_packages=$(find build_packages -type f -name "OTB*Linux*.tar.gz") + for pkg in $rh_packages + do + new_name=$(sed "s/-Linux/-Linux_RedHat/g" <<< "$pkg") + mv $pkg $new_name + done + - mv build_packages/OTB-*.tar.gz . || true + needs: + - job: redhat-prepare + artifacts: true ## Windows .windows-prepare: @@ -268,160 +268,160 @@ windows-10-build: artifacts: true #------------------------- QA related jobs ------------------------------------- -# ubuntu-qa-code-coverage: -# extends: .common-build -# only: -# refs: -# - merge_requests -# - develop -# - /^release-[0-9]+\.[0-9]+$/ -# variables: -# - $SONAR_OTB_TOKEN -# image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa-headless:20.04 -# script: -# - ctest -V -S CI/main_qa.cmake -# -DIMAGE_NAME:string=ubuntu-20.04-llvm-qa -# -DQA:BOOL=ON -# - ./CI/otb_coverage.sh -# - saxon-xslt -o build/ctest_report.xml -# build/Testing/`head -n 1 build/Testing/TAG`/Test.xml -# CI/ctest2junit.xsl -# needs: -# - job: ubuntu-20-prepare -# artifacts: true +ubuntu-qa-code-coverage: + extends: .common-build + only: + refs: + - merge_requests + - develop + - /^release-[0-9]+\.[0-9]+$/ + variables: + - $SONAR_OTB_TOKEN + image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa-headless:20.04 + script: + - ctest -V -S CI/main_qa.cmake + -DIMAGE_NAME:string=ubuntu-20.04-llvm-qa + -DQA:BOOL=ON + - ./CI/otb_coverage.sh + - saxon-xslt -o build/ctest_report.xml + build/Testing/`head -n 1 build/Testing/TAG`/Test.xml + CI/ctest2junit.xsl + needs: + - job: ubuntu-20-prepare + artifacts: true -# ubuntu-qa-static-analysis: -# extends: .common-build -# only: -# refs: -# - merge_requests -# - develop -# - /^release-[0-9]+\.[0-9]+$/ -# variables: -# - $SONAR_OTB_TOKEN -# image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa-headless:20.04 -# script: -# - find Modules -type f -regextype posix-extended -regex '.*\.(h|hxx)$' -exec dirname '{}' \; | -# grep -vE '^Modules/ThirdParty/' | -# sort -u > header_directories -# - cppcheck -j 8 -q --xml --xml-version=2 --enable=all -# --language=c++ --std=c++14 --platform=unix64 -# --includes-file=header_directories -# -i Modules/ThirdParty Modules -# 2> build/cppcheck_report.xml -# after_script: [] -# needs: -# - job: ubuntu-20-prepare -# artifacts: true +ubuntu-qa-static-analysis: + extends: .common-build + only: + refs: + - merge_requests + - develop + - /^release-[0-9]+\.[0-9]+$/ + variables: + - $SONAR_OTB_TOKEN + image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa-headless:20.04 + script: + - find Modules -type f -regextype posix-extended -regex '.*\.(h|hxx)$' -exec dirname '{}' \; | + grep -vE '^Modules/ThirdParty/' | + sort -u > header_directories + - cppcheck -j 8 -q --xml --xml-version=2 --enable=all + --language=c++ --std=c++14 --platform=unix64 + --includes-file=header_directories + -i Modules/ThirdParty Modules + 2> build/cppcheck_report.xml + after_script: [] + needs: + - job: ubuntu-20-prepare + artifacts: true -# ubuntu-sonar-report: -# extends: .common -# variables: -# GIT_DEPTH: "" -# image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa-headless:20.04 -# stage: report -# only: -# refs: -# - merge_requests -# - develop -# - /^release-[0-9]+\.[0-9]+$/ -# variables: -# - $SONAR_OTB_TOKEN -# script: -# - sonar-scanner -Dproject.settings=sonar-project.properties -# -Dsonar.host.url=https://sonar.orfeo-toolbox.org -# -Dsonar.login=$SONAR_OTB_TOKEN -# -Dsonar.projectKey=$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME -# `test -z "$CI_COMMIT_TAG" || echo "-Dsonar.projectVersion=$CI_COMMIT_TAG"` -# -Dsonar.branch.name=$CI_COMMIT_REF_NAME +ubuntu-sonar-report: + extends: .common + variables: + GIT_DEPTH: "" + image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa-headless:20.04 + stage: report + only: + refs: + - merge_requests + - develop + - /^release-[0-9]+\.[0-9]+$/ + variables: + - $SONAR_OTB_TOKEN + script: + - sonar-scanner -Dproject.settings=sonar-project.properties + -Dsonar.host.url=https://sonar.orfeo-toolbox.org + -Dsonar.login=$SONAR_OTB_TOKEN + -Dsonar.projectKey=$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME + `test -z "$CI_COMMIT_TAG" || echo "-Dsonar.projectVersion=$CI_COMMIT_TAG"` + -Dsonar.branch.name=$CI_COMMIT_REF_NAME -# after_script: [] -# needs: -# - job: ubuntu-qa-code-coverage -# artifacts: true -# - job: ubuntu-qa-static-analysis -# artifacts: true + after_script: [] + needs: + - job: ubuntu-qa-code-coverage + artifacts: true + - job: ubuntu-qa-static-analysis + artifacts: true #---------------------------- Deploy job --------------------------------------- -# deploy: -# tags: -# - deploy -# image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7 -# stage: deploy -# extends: .general -# only: -# - develop@orfeotoolbox/otb -# - /^release-[0-9]+\.[0-9]+$/ -# before_script: -# # Provision efficiently the local LFS cache before checkout -# - git lfs fetch origin $CI_COMMIT_SHA -# - git checkout -f -q $CI_COMMIT_SHA -# script: -# - ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER -# needs: -# - job: ubuntu-20-build -# artifacts: true -# - job: windows-10-build -# artifacts: true -# - job: redhat-build -# artifacts: true +deploy: + tags: + - deploy + image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7 + stage: deploy + extends: .general + only: + - develop@orfeotoolbox/otb + - /^release-[0-9]+\.[0-9]+$/ + before_script: + # Provision efficiently the local LFS cache before checkout + - git lfs fetch origin $CI_COMMIT_SHA + - git checkout -f -q $CI_COMMIT_SHA + script: + - ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER + needs: + - job: ubuntu-20-build + artifacts: true + - job: windows-10-build + artifacts: true + - job: redhat-build + artifacts: true -# update-archive: -# tags: -# - deploy -# image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base-headless:20.04 -# stage: deploy -# extends: .general -# only: -# - develop -# - /^release-[0-9]+\.[0-9]+$/@orfeotoolbox/otb -# before_script: -# # Provision efficiently the local LFS cache before checkout -# - git lfs fetch origin $CI_COMMIT_SHA -# - git checkout -f -q $CI_COMMIT_SHA -# script: -# - ./CI/SuperbuildDownloadList.sh download build_archive -# - ./CI/deploy-archive.sh build_archive -# needs: -# # don't push the archive if Superbuild was not successful -# - job: ubuntu-20-prepare -# artifacts: false +update-archive: + tags: + - deploy + image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base-headless:20.04 + stage: deploy + extends: .general + only: + - develop + - /^release-[0-9]+\.[0-9]+$/@orfeotoolbox/otb + before_script: + # Provision efficiently the local LFS cache before checkout + - git lfs fetch origin $CI_COMMIT_SHA + - git checkout -f -q $CI_COMMIT_SHA + script: + - ./CI/SuperbuildDownloadList.sh download build_archive + - ./CI/deploy-archive.sh build_archive + needs: + # don't push the archive if Superbuild was not successful + - job: ubuntu-20-prepare + artifacts: false -# release-container: -# image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7 -# stage: deploy -# extends: .general -# only: -# refs: -# - tags@orfeotoolbox/otb -# variables: -# - $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/ -# script: -# - curl --request POST -# --form token=$K8S_SECRET_RELEASE -# --form ref=master -# --form variables[OTB_TAG]=$CI_COMMIT_TAG -# https://gitlab.orfeo-toolbox.org/api/v4/projects/126/trigger/pipeline +release-container: + image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7 + stage: deploy + extends: .general + only: + refs: + - tags@orfeotoolbox/otb + variables: + - $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/ + script: + - curl --request POST + --form token=$K8S_SECRET_RELEASE + --form ref=master + --form variables[OTB_TAG]=$CI_COMMIT_TAG + https://gitlab.orfeo-toolbox.org/api/v4/projects/126/trigger/pipeline -# release-docker: -# image: -# name: gcr.io/kaniko-project/executor:debug -# entrypoint: [""] -# stage: docker -# only: -# refs: -# - /^release-[0-9]+\.[0-9]+$/ -# needs: -# - job: ubuntu-20-build -# artifacts: true -# script: -# # to authenticate in docker hub, kaniko needs a config file located at -# # /kaniko/.docker/config.json -# - mkdir -p /kaniko/.docker ||Â true -# - echo "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$(printf "%s:%s" "${DOCKER_HUB_USER}" "${DOCKER_HUB_PWD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json -# - /kaniko/executor --cleanup -# --verbosity warn -# --context $CI_PROJECT_DIR -# --dockerfile $CI_PROJECT_DIR/Docker/Dockerfile_CI -# --destination orfeotoolbox/otb:$CI_COMMIT_TAG +release-docker: + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + stage: docker + only: + refs: + - /^release-[0-9]+\.[0-9]+$/ + needs: + - job: ubuntu-20-build + artifacts: true + script: + # to authenticate in docker hub, kaniko needs a config file located at + # /kaniko/.docker/config.json + - mkdir -p /kaniko/.docker ||Â true + - echo "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$(printf "%s:%s" "${DOCKER_HUB_USER}" "${DOCKER_HUB_PWD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --cleanup + --verbosity warn + --context $CI_PROJECT_DIR + --dockerfile $CI_PROJECT_DIR/Docker/Dockerfile_CI + --destination orfeotoolbox/otb:$CI_COMMIT_TAG