.gitlab-ci.yml 5.91 KB
Newer Older
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
1 2 3 4 5
# WARNING!
# OTB uses Git-LFS to store the (large) tests data.
# Git-LFS is mostly transparent for the user and recent versions
# are able to use Git-LFS quite efficiently.
# But Git fails to manage efficiently numerous LFS data.
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
6
# We have to use directly git-lfs wrapping commands to have an
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
7
# efficient cloning step.
8
# Furthermore, Git-LFS and Gitlab sufer a bug preventing usage of
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
9 10
# GIT_STRATEGY=fetch (https://gitlab.com/gitlab-org/gitlab-runner/issues/3318)

Sébastien Dinot's avatar
Sébastien Dinot committed
11
variables:
12
  BUILD_IMAGE_REGISTRY: $CI_REGISTRY/orfeotoolbox/otb-build-env
13
  GIT_CLONE_PATH: $CI_BUILDS_DIR/otb
Sébastien Dinot's avatar
Sébastien Dinot committed
14
  DOCKER_DRIVER: overlay2
15
  GIT_DEPTH: "3"
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
16
  # Disable automatic checkout to let us fetch LFS before
17
  GIT_CHECKOUT: "false"
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
18
  # The fetch strategy fails with LFS and GitLab
19
  GIT_STRATEGY: "clone"
20

Antoine Regimbeau's avatar
Antoine Regimbeau committed
21

22
before_script:
23 24
  # make sure LFS hooks are installed
  - git lfs install
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
25
  # Provision efficiently the local LFS cache before checkout
26
  - git lfs fetch origin $CI_COMMIT_SHA
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
27
  # Checkout the expected branch
28
  - git checkout $CI_COMMIT_REF_NAME
Sébastien Dinot's avatar
Sébastien Dinot committed
29

30
after_script:
Antoine Regimbeau's avatar
Antoine Regimbeau committed
31
  - python3 CI/cdash_handler.py $CI_COMMIT_SHA $CI_PROJECT_ID $CI_PROJECT_DIR $K8S_SECRET_CDASH
32

Sébastien Dinot's avatar
Sébastien Dinot committed
33
stages:
Guillaume Pasero's avatar
Guillaume Pasero committed
34
  - precheck
aregimbe's avatar
aregimbe committed
35
  - prepare
Sébastien Dinot's avatar
Sébastien Dinot committed
36 37
  - build

38
.general:
Sébastien Dinot's avatar
Sébastien Dinot committed
39 40 41 42 43 44
  retry:
    max: 2
    when:
      - runner_system_failure
      - stuck_or_timeout_failure

45 46 47 48
#fast-build:
#  extends: .general
#  only: [merge_requests, branches]
#  stage: precheck
49
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-native-develop:latest
50 51 52 53 54 55 56
#  before_script:
#    - export GIT_LFS_SKIP_SMUDGE=1
#    - git checkout $CI_COMMIT_REF_NAME
#    - python3 CI/check_twin_pipelines.py
#  script:
#    - ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-fast
#    - ccache -s
Guillaume Pasero's avatar
Guillaume Pasero committed
57

Guillaume Pasero's avatar
Guillaume Pasero committed
58
.common-build:
59 60 61
  extends: .general
  only: [merge_requests]
  stage: build
62
  dependencies: []
Guillaume Pasero's avatar
Guillaume Pasero committed
63 64 65

debian-build:
  extends: .common-build
66 67 68
  image: $BUILD_IMAGE_REGISTRY/otb-debian-native:unstable
  script:
    - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=debian-unstable-gcc
Antoine Regimbeau's avatar
Antoine Regimbeau committed
69

Guillaume Pasero's avatar
Guillaume Pasero committed
70 71
ubuntu-llvm:
  extends: .common-build
72
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-native:18.04
Antoine Regimbeau's avatar
Antoine Regimbeau committed
73
  script:
74
    - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm
75 76 77 78 79
  artifacts:
    paths:
      - build/CookBook-*-html.tar.gz
      - build/Documentation/Cookbook/latex/CookBook-*.pdf
      - build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2
aregimbe's avatar
aregimbe committed
80

81
.common-prepare:
aregimbe's avatar
aregimbe committed
82
  extends: .general
Guillaume Pasero's avatar
Guillaume Pasero committed
83
  only: [merge_requests]
aregimbe's avatar
aregimbe committed
84 85 86 87 88 89 90 91 92 93 94 95 96
  stage: prepare
  before_script:
# This override the previous before_script
    - git checkout $CI_COMMIT_REF_NAME
# We are now doing the git-lfs install
# This is done after the checkout so we avoid downloading Data
# But we need it to upload the archive
    - git-lfs install
    - git config --global user.email "otbbot@orfeo-toolbox.org"
    - git config --global user.name "otbbot"
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$K8S_SECRET_SSH")
# This is for debug, we are checking the owner of the ssh key
aregimbe's avatar
aregimbe committed
97
    - ssh -o StrictHostKeyChecking=no -T git@gitlab.orfeo-toolbox.org
98 99
  after_script:
    - echo "Nothing to do for after_script"
aregimbe's avatar
aregimbe committed
100 101 102 103 104
  artifacts:
    expire_in: 24 hrs
    paths:
      # This recovers logs from superbuild build
      - build/*/*/*/*.log
105
      - sb_branch.txt
aregimbe's avatar
aregimbe committed
106

107 108 109 110
ubuntu-superbuild-prepare:
  extends: .common-prepare
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
  script:
111
    - ctest -V -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base
112 113 114 115 116

centos-superbuild-prepare:
  extends: .common-prepare
  image: $BUILD_IMAGE_REGISTRY/otb-centos-superbuild-base:6.6
  script:
117
    - ctest -V -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=otb-centos-superbuild-base
118

119 120 121 122
ubuntu-superbuild-build:
  extends: .common-build
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
  script:
123
    - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base
124 125
  dependencies:
    - ubuntu-superbuild-prepare
126 127

centos-superbuild-build:
Guillaume Pasero's avatar
Guillaume Pasero committed
128
  extends: .common-build
129 130
  image: $BUILD_IMAGE_REGISTRY/otb-centos-superbuild-base:6.6
  script:
131
    - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=otb-centos-superbuild-base
132
  dependencies:
133
    - centos-superbuild-prepare
Cédric Traizet's avatar
Cédric Traizet committed
134 135 136 137 138 139 140

macos-superbuild-prepare:
  tags:
    - macos
  only: [merge_requests, branches]
  extends: .common-prepare
  stage: prepare
141
  before_script:
142
    - echo $GIT_CLONE_PATH
143 144
# This override the previous before_script
    - git checkout $CI_COMMIT_REF_NAME
Cédric Traizet's avatar
Cédric Traizet committed
145 146
  script:
    - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=otb-macos-superbuild
147 148 149 150 151 152
  artifacts:
    expire_in: 24 hrs
    paths:
      # This recovers logs from superbuild build
      - build/*/*/*/*.log
      - sb_branch.txt
Cédric Traizet's avatar
Cédric Traizet committed
153 154 155 156 157 158 159

macos-superbuild-build:
  tags:
    - macos
  only: [merge_requests, branches]
  extends: .general
  stage: build
160
  before_script:
161
# First we need to clean the environment
162 163 164 165 166
    - rm -rf ../../xdk # install dir
    - rm -rf ../../SuperBuild_Install.tar # sb tar
    # - rm -rf otb/sb_branch.txt # sb_branch
    # - rm -rf otb/build # binary dir
    - rm -rf ../superbuild-artifact # sb_artifact folder
167 168 169 170 171
# This override the previous before_script
    - git checkout $CI_COMMIT_REF_NAME
# We are now doing the git-lfs install
# This is done after the checkout so we avoid downloading Data
# But we need it to upload the archive
172 173 174 175 176 177
    # - git-lfs install
    # - git config --global user.email "otbbot@orfeo-toolbox.org"
    # - git config --global user.name "otbbot"
    # - eval $(ssh-agent -s)
    # - ssh-add <(echo "$K8S_SECRET_SSH")
    # we do not need this as we are on a persistent machine
178 179 180 181
# This is for debug, we are checking the owner of the ssh key
    - ssh -o StrictHostKeyChecking=no -T git@gitlab.orfeo-toolbox.org
  after_script:
    - echo "Nothing to do for after_script"
Cédric Traizet's avatar
Cédric Traizet committed
182
  script:
183
    - ctest -VV -S CI/main_superbuild.cmake -DIMAGE_NAME:string=otb-macos-superbuild
Cédric Traizet's avatar
Cédric Traizet committed
184 185
  dependencies:
    - macos-superbuild-prepare