.gitlab-ci.yml 6.75 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 41 42 43 44 45 46
  before_script:
    - git lfs install --skip-repo
    # Provision efficiently the local LFS cache before checkout
    - git lfs fetch origin $CI_COMMIT_SHA
    # Checkout the expected branch
    - git checkout -f -q $CI_COMMIT_SHA
  after_script:
    - python3 CI/cdash_handler.py

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

Guillaume Pasero's avatar
Guillaume Pasero committed
58
.common-build:
Guillaume Pasero's avatar
Guillaume Pasero committed
59
  extends: .common
60 61 62 63
  only:
    - merge_requests
    - develop
    - /^release-[0-9]+\.[0-9]+$/
64
  stage: build
65 66 67 68 69 70 71 72 73
  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
74 75
      - build_packages/OTB-*.run
      - build_packages/OTB-*.zip
Guillaume Pasero's avatar
Guillaume Pasero committed
76

77 78 79 80 81
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
82

83
.common-prepare:
aregimbe's avatar
aregimbe committed
84
  extends: .general
85 86 87 88
  only:
    - merge_requests
    - develop
    - /^release-[0-9]+\.[0-9]+$/
aregimbe's avatar
aregimbe committed
89 90
  stage: prepare
  before_script:
Antoine Regimbeau's avatar
Antoine Regimbeau committed
91
    - git lfs install --skip-repo
92 93 94
    - export GIT_LFS_SKIP_SMUDGE=1
    - git checkout -f -q $CI_COMMIT_SHA
    - export GIT_LFS_SKIP_SMUDGE=0
aregimbe's avatar
aregimbe committed
95 96
  artifacts:
    expire_in: 24 hrs
Antoine Regimbeau's avatar
Antoine Regimbeau committed
97
    when: always
aregimbe's avatar
aregimbe committed
98
    paths:
Antoine Regimbeau's avatar
Antoine Regimbeau committed
99 100
      - sb_branch.txt # Needed to checkout correct branch in build step
      - build/*/*/*/*.log # Superbuild log
aregimbe's avatar
aregimbe committed
101

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

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

Antoine Regimbeau's avatar
Antoine Regimbeau committed
118
## CentOS superbuild
Guillaume Pasero's avatar
Guillaume Pasero committed
119
centos-xdk-prepare:
120 121 122 123 124
  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
125
centos-xdk-build:
126 127 128 129 130 131
  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
    - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -VV -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-centos-superbuild-base
  dependencies:
Guillaume Pasero's avatar
Guillaume Pasero committed
132
    - centos-xdk-prepare
Cédric Traizet's avatar
Cédric Traizet committed
133

Antoine Regimbeau's avatar
Antoine Regimbeau committed
134
## MacOS superbuild
Guillaume Pasero's avatar
Guillaume Pasero committed
135
macos-xdk-prepare:
136 137 138 139 140 141 142 143 144 145 146
  tags:
    - macos
  extends: .common-prepare
  before_script:
    # No need to install lfs as this machine is persistent
    - export GIT_LFS_SKIP_SMUDGE=1
    - git checkout -f -q $CI_COMMIT_SHA
    - export GIT_LFS_SKIP_SMUDGE=0
  script:
    - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=otb-macos-superbuild

Guillaume Pasero's avatar
Guillaume Pasero committed
147
macos-xdk-build:
148 149 150 151 152 153 154
  tags:
    - macos
  extends: .common-build
  script:
    - ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=otb-macos-superbuild
    - ctest -VV -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-macos-superbuild
  dependencies:
Guillaume Pasero's avatar
Guillaume Pasero committed
155
    - macos-xdk-prepare
156

Guillaume Pasero's avatar
Guillaume Pasero committed
157
## Windows
158
.windows-prepare:
Guillaume Pasero's avatar
Guillaume Pasero committed
159
  extends: .common-prepare
aregimbe's avatar
aregimbe committed
160 161
  before_script:
# This override the previous before_script
162
    - set GIT_LFS_SKIP_SMUDGE=1
Guillaume Pasero's avatar
Guillaume Pasero committed
163
    - git checkout -f -q %CI_COMMIT_SHA%
164
    - set GIT_LFS_SKIP_SMUDGE=0
165

166
.windows-build:
Guillaume Pasero's avatar
Guillaume Pasero committed
167 168 169
  extends: .common-build
  before_script:
    - git lfs fetch origin %CI_COMMIT_SHA%
170
    - git checkout -f -q %CI_COMMIT_SHA%
171

Guillaume Pasero's avatar
Guillaume Pasero committed
172
# - Win10
173 174
windows-10-prepare:
  extends: .windows-prepare
175 176
  tags:
    - windows10
177
  script:
Guillaume Pasero's avatar
Guillaume Pasero committed
178
    - call ./CI/dev_env.bat x64 xdk 10
179 180 181 182
    - clcache.exe -s
    - ctest -C Release -V -S CI/prepare_superbuild.cmake
    - clcache.exe -s

183
windows-10-build:
184
  extends: .windows-build
Guillaume Pasero's avatar
Guillaume Pasero committed
185
  tags:
186
    - windows10
Guillaume Pasero's avatar
Guillaume Pasero committed
187 188 189 190 191
  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
192
    - ctest -V -S CI/main_packages.cmake
Guillaume Pasero's avatar
Guillaume Pasero committed
193 194 195
  dependencies:
    - windows-10-prepare

Guillaume Pasero's avatar
Guillaume Pasero committed
196 197 198 199 200 201 202 203 204 205 206
# - 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
207
windows-8-build:
208
  extends: .windows-build
Guillaume Pasero's avatar
Guillaume Pasero committed
209
  tags:
210
    - windows8
Guillaume Pasero's avatar
Guillaume Pasero committed
211
  script:
Guillaume Pasero's avatar
Guillaume Pasero committed
212
    - call ./CI/dev_env.bat x86 otb 8.1
Guillaume Pasero's avatar
Guillaume Pasero committed
213 214 215
    - clcache.exe -s
    - ctest -V -S CI/main_superbuild.cmake
    - clcache.exe -s
Guillaume Pasero's avatar
Guillaume Pasero committed
216
    - ctest -V -S CI/main_packages.cmake
Guillaume Pasero's avatar
Guillaume Pasero committed
217 218
  dependencies:
    - windows-8-prepare
219

220
    
221 222 223 224 225 226 227 228 229
# Deploy job

deploy:
  tags:
    - deploy
  image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
  stage: deploy
  extends: .general
  only:
230 231 232 233 234
    refs:
      - develop
      - /^release-[0-9]+\.[0-9]+$/
    variables:
      - $CI_PROJECT_NAMESPACE == "orfeotoolbox"
235 236 237 238 239 240 241
  before_script:
    - git lfs install --skip-repo
    # Provision efficiently the local LFS cache before checkout
    - git lfs fetch origin $CI_COMMIT_SHA
    # Checkout the expected branch
    - git checkout -f -q $CI_COMMIT_SHA
  script:
242
    - ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER
243
  dependencies:
244 245 246 247
    - ubuntu-xdk-build 
    - centos-xdk-build
    - macos-xdk-build
    - windows-8-build
248
    - windows-10-build