.gitlab-ci.yml 6.99 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

Sébastien Dinot's avatar
Sébastien Dinot committed
21
stages:
Guillaume Pasero's avatar
Guillaume Pasero committed
22
  - precheck
aregimbe's avatar
aregimbe committed
23
  - prepare
Sébastien Dinot's avatar
Sébastien Dinot committed
24
  - build
25
  - deploy
Sébastien Dinot's avatar
Sébastien Dinot committed
26

27
.general:
Sébastien Dinot's avatar
Sébastien Dinot committed
28 29 30 31 32 33
  retry:
    max: 2
    when:
      - runner_system_failure
      - stuck_or_timeout_failure

Guillaume Pasero's avatar
Guillaume Pasero committed
34
.common:
Antoine Regimbeau's avatar
Antoine Regimbeau committed
35
  extends: .general
Guillaume Pasero's avatar
Guillaume Pasero committed
36 37 38 39 40
  before_script:
    # Provision efficiently the local LFS cache before checkout
    - git lfs fetch origin $CI_COMMIT_SHA
    - git checkout -f -q $CI_COMMIT_SHA
  after_script:
Guillaume Pasero's avatar
Guillaume Pasero committed
41
    - python3 -u CI/cdash_handler.py
Guillaume Pasero's avatar
Guillaume Pasero committed
42

Guillaume Pasero's avatar
Guillaume Pasero committed
43
.common-build:
Guillaume Pasero's avatar
Guillaume Pasero committed
44
  extends: .common
45 46 47 48
  only:
    - merge_requests
    - develop
    - /^release-[0-9]+\.[0-9]+$/
49
  stage: build
50 51 52 53 54 55 56 57 58
  artifacts:
    when: always
    expire_in: 24 hrs
    paths:
      - build/*/*.log #CMake log
      - log/*.txt # Others
      - build/CookBook-*-html.tar.gz
      - build/Documentation/Cookbook/latex/CookBook-*.pdf
      - build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2
59 60
      - build_packages/OTB-*.run
      - build_packages/OTB-*.zip
Guillaume Pasero's avatar
Guillaume Pasero committed
61

62
.common-prepare:
aregimbe's avatar
aregimbe committed
63
  extends: .general
64 65 66 67
  only:
    - merge_requests
    - develop
    - /^release-[0-9]+\.[0-9]+$/
aregimbe's avatar
aregimbe committed
68 69
  stage: prepare
  before_script:
70 71 72
    - export GIT_LFS_SKIP_SMUDGE=1
    - git checkout -f -q $CI_COMMIT_SHA
    - export GIT_LFS_SKIP_SMUDGE=0
aregimbe's avatar
aregimbe committed
73 74
  artifacts:
    expire_in: 24 hrs
Antoine Regimbeau's avatar
Antoine Regimbeau committed
75
    when: always
aregimbe's avatar
aregimbe committed
76
    paths:
Antoine Regimbeau's avatar
Antoine Regimbeau committed
77 78
      - sb_branch.txt # Needed to checkout correct branch in build step
      - build/*/*/*/*.log # Superbuild log
aregimbe's avatar
aregimbe committed
79

80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
#-------------------------- precheck job ---------------------------------------
fast-build:
  extends: .common
  only: [merge_requests, branches]
  stage: precheck
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-native-develop:latest
  before_script:
    - export GIT_LFS_SKIP_SMUDGE=1
    - git checkout -f -q $CI_COMMIT_SHA
    - python3 CI/check_twin_pipelines.py
  script:
    - ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-fast
    - ccache -s

#------------------------- prepare & build jobs --------------------------------
debian-build:
  extends: .common-build
  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

101
## Ubuntu superbuild
Guillaume Pasero's avatar
Guillaume Pasero committed
102
ubuntu-xdk-prepare:
103 104 105
  extends: .common-prepare
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
  script:
106
    - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base
107

Guillaume Pasero's avatar
Guillaume Pasero committed
108
ubuntu-xdk-build:
109 110 111
  extends: .common-build
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
  script:
112
    - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-xdk
113
    - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base -DNAME_SUFFIX:string=-glibc-2.27
114
  dependencies:
Guillaume Pasero's avatar
Guillaume Pasero committed
115
    - ubuntu-xdk-prepare
116

Antoine Regimbeau's avatar
Antoine Regimbeau committed
117
## CentOS superbuild
Guillaume Pasero's avatar
Guillaume Pasero committed
118
centos-xdk-prepare:
119 120 121 122 123
  extends: .common-prepare
  image: $BUILD_IMAGE_REGISTRY/otb-centos-superbuild-base:6.6
  script:
    - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=otb-centos-superbuild-base

Guillaume Pasero's avatar
Guillaume Pasero committed
124
centos-xdk-build:
125 126 127 128
  extends: .common-build
  image: $BUILD_IMAGE_REGISTRY/otb-centos-superbuild-base:6.6
  script:
    - 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
129
    - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-centos-superbuild-base
130
  dependencies:
Guillaume Pasero's avatar
Guillaume Pasero committed
131
    - centos-xdk-prepare
Cédric Traizet's avatar
Cédric Traizet committed
132

Antoine Regimbeau's avatar
Antoine Regimbeau committed
133
## MacOS superbuild
Guillaume Pasero's avatar
Guillaume Pasero committed
134
macos-xdk-prepare:
135
  extends: .common-prepare
136 137 138 139 140
  tags:
    - macos
  script:
    - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=otb-macos-superbuild

Guillaume Pasero's avatar
Guillaume Pasero committed
141
macos-xdk-build:
142 143 144 145 146
  tags:
    - macos
  extends: .common-build
  script:
    - ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=otb-macos-superbuild
147
    - ctest -V -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-macos-superbuild
148
  dependencies:
Guillaume Pasero's avatar
Guillaume Pasero committed
149
    - macos-xdk-prepare
150

Guillaume Pasero's avatar
Guillaume Pasero committed
151
## Windows
152
.windows-prepare:
Guillaume Pasero's avatar
Guillaume Pasero committed
153
  extends: .common-prepare
aregimbe's avatar
aregimbe committed
154 155
  before_script:
# This override the previous before_script
156
    - set GIT_LFS_SKIP_SMUDGE=1
Guillaume Pasero's avatar
Guillaume Pasero committed
157
    - git checkout -f -q %CI_COMMIT_SHA%
158
    - set GIT_LFS_SKIP_SMUDGE=0
159

160
.windows-build:
Guillaume Pasero's avatar
Guillaume Pasero committed
161 162 163
  extends: .common-build
  before_script:
    - git lfs fetch origin %CI_COMMIT_SHA%
164
    - git checkout -f -q %CI_COMMIT_SHA%
165

Guillaume Pasero's avatar
Guillaume Pasero committed
166
# - Win10
167 168
windows-10-prepare:
  extends: .windows-prepare
169 170
  tags:
    - windows10
171
  script:
Guillaume Pasero's avatar
Guillaume Pasero committed
172
    - call ./CI/dev_env.bat x64 xdk 10
173 174 175 176
    - clcache.exe -s
    - ctest -C Release -V -S CI/prepare_superbuild.cmake
    - clcache.exe -s

177
windows-10-build:
178
  extends: .windows-build
Guillaume Pasero's avatar
Guillaume Pasero committed
179
  tags:
180
    - windows10
Guillaume Pasero's avatar
Guillaume Pasero committed
181 182 183 184 185
  script:
    - call ./CI/dev_env.bat x64 otb 10
    - clcache.exe -s
    - ctest -V -S CI/main_superbuild.cmake
    - clcache.exe -s
Guillaume Pasero's avatar
Guillaume Pasero committed
186
    - ctest -V -S CI/main_packages.cmake
Guillaume Pasero's avatar
Guillaume Pasero committed
187 188 189
  dependencies:
    - windows-10-prepare

Guillaume Pasero's avatar
Guillaume Pasero committed
190 191 192 193 194 195 196 197 198 199 200
# - Win8.1
windows-8-prepare:
  extends: .windows-prepare
  tags:
    - windows8
  script:
    - call ./CI/dev_env.bat x86 xdk 8.1
    - clcache.exe -s
    - ctest -C Release -V -S CI/prepare_superbuild.cmake
    - clcache.exe -s

Guillaume Pasero's avatar
Guillaume Pasero committed
201
windows-8-build:
202
  extends: .windows-build
Guillaume Pasero's avatar
Guillaume Pasero committed
203
  tags:
204
    - windows8
Guillaume Pasero's avatar
Guillaume Pasero committed
205
  script:
Guillaume Pasero's avatar
Guillaume Pasero committed
206
    - call ./CI/dev_env.bat x86 otb 8.1
Guillaume Pasero's avatar
Guillaume Pasero committed
207 208 209
    - clcache.exe -s
    - ctest -V -S CI/main_superbuild.cmake
    - clcache.exe -s
Guillaume Pasero's avatar
Guillaume Pasero committed
210
    - ctest -V -S CI/main_packages.cmake
Guillaume Pasero's avatar
Guillaume Pasero committed
211 212
  dependencies:
    - windows-8-prepare
213

214
#---------------------------- Deploy job ---------------------------------------
215 216 217 218 219 220 221
deploy:
  tags:
    - deploy
  image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
  stage: deploy
  extends: .general
  only:
Guillaume Pasero's avatar
Guillaume Pasero committed
222 223
    - develop@orfeotoolbox/otb
    - /^release-[0-9]+\.[0-9]+$/@orfeotoolbox/otb
224 225 226 227 228
  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:
229
    - ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER
230
  dependencies:
231 232 233 234
    - ubuntu-xdk-build 
    - centos-xdk-build
    - macos-xdk-build
    - windows-8-build
235
    - windows-10-build
236 237 238 239 240 241 242 243 244 245 246 247

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"