.gitlab-ci.yml 6.73 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
  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:
43
    - python3 --version
Guillaume Pasero's avatar
Guillaume Pasero committed
44
    - python3 -v -u CI/cdash_handler.py
45
    - echo cdash_handler done
Guillaume Pasero's avatar
Guillaume Pasero committed
46 47 48

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

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

79 80 81 82 83
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
Antoine Regimbeau's avatar
Antoine Regimbeau committed
84

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

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

Guillaume Pasero's avatar
Guillaume Pasero committed
111
ubuntu-xdk-build:
112 113 114
  extends: .common-build
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
  script:
115
    - 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
116
    - 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
117
  dependencies:
Guillaume Pasero's avatar
Guillaume Pasero committed
118
    - ubuntu-xdk-prepare
119

Antoine Regimbeau's avatar
Antoine Regimbeau committed
120
## CentOS superbuild
Guillaume Pasero's avatar
Guillaume Pasero committed
121
centos-xdk-prepare:
122 123 124 125 126
  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
127
centos-xdk-build:
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
132
    - 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
133
  dependencies:
Guillaume Pasero's avatar
Guillaume Pasero committed
134
    - centos-xdk-prepare
Cédric Traizet's avatar
Cédric Traizet committed
135

Antoine Regimbeau's avatar
Antoine Regimbeau committed
136
## MacOS superbuild
Guillaume Pasero's avatar
Guillaume Pasero committed
137
macos-xdk-prepare:
138 139 140 141 142 143 144 145 146 147 148
  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
149
macos-xdk-build:
150 151 152 153 154 155 156
  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
157
    - macos-xdk-prepare
158

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

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

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

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

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

222
    
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
# Deploy job

deploy:
  tags:
    - deploy
  image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
  stage: deploy
  extends: .general
  only:
    - develop
    - /^release-[0-9]+\.[0-9]+$/
  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:
241
    - ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER
242
  dependencies:
243 244 245 246
    - ubuntu-xdk-build 
    - centos-xdk-build
    - macos-xdk-build
    - windows-8-build
247
    - windows-10-build