.gitlab-ci.yml 5.02 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
Sébastien Dinot's avatar
Sébastien Dinot committed
13
  DOCKER_DRIVER: overlay2
14
  GIT_DEPTH: "3"
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
15
  # Disable automatic checkout to let us fetch LFS before
16
  GIT_CHECKOUT: "false"
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
17
  # The fetch strategy fails with LFS and GitLab
18
  GIT_STRATEGY: "clone"
19 20

before_script:
21
  # make sure LFS hooks are installed
22
  - git lfs install
23 24 25
  # Setup user.
  - git config --global user.email "otbbot@orfeo-toolbox.org"
  - git config --global user.name "otbbot"
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
26
  # Provision efficiently the local LFS cache before checkout
27
  - git lfs fetch origin $CI_COMMIT_SHA
Guilhem Bonnefille's avatar
Guilhem Bonnefille committed
28
  # Checkout the expected branch
29
  - git checkout $CI_COMMIT_REF_NAME
Sébastien Dinot's avatar
Sébastien Dinot committed
30

31 32
after_script:
  - python3 CI/cdash_handler.py $CI_COMMIT_SHA $CI_PROJECT_ID $CI_PROJECT_DIR $K8S_SECRET_CDASH
33

Sébastien Dinot's avatar
Sébastien Dinot committed
34
stages:
35
  - precheck
aregimbe's avatar
aregimbe committed
36
  - prepare
Sébastien Dinot's avatar
Sébastien Dinot committed
37
  - build
38
  - package
Sébastien Dinot's avatar
Sébastien Dinot committed
39

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

47 48 49 50 51 52 53 54 55 56 57 58 59
# WiP: Disabled to fasten CI packaging development.
# fast-build:
#   extends: .general
#   only: [merge_requests, branches]
#   stage: precheck
#   image: $CI_REGISTRY/gpasero/otb/otb-install-ubuntu-native
#   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
60

61 62 63 64

##
## Native builds section

65
.common-build:
66
  extends: .general
67
  only: [merge_requests]
Antoine Regimbeau's avatar
Antoine Regimbeau committed
68
  stage: build
69 70 71 72

debian-build:
  extends: .common-build
  image: $BUILD_IMAGE_REGISTRY/otb-debian-native:unstable
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=debian-unstable-gcc
75

76 77 78 79 80 81 82 83 84 85 86
ubuntu-llvm:
  extends: .common-build
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-native:18.04
  script:
    - 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
  artifacts:
    paths:
      - build/CookBook-*-html.tar.gz
      - build/Documentation/Cookbook/latex/CookBook-*.pdf
      - build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2

87 88 89 90 91

##
## SuperBuild XDK build section.
##

92
.common-prepare:
93
  extends: .general
94
  only: [merge_requests, branches]
95 96 97 98 99 100 101 102
  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
103 104
    - git config --global user.email "otbbot@orfeo-toolbox.org"
    - git config --global user.name "otbbot"
105 106 107 108 109 110 111 112 113 114
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$K8S_SECRET_SSH")
# 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"
  artifacts:
    expire_in: 24 hrs
    paths:
      # This recovers logs from superbuild build
115
      # - build/*/*/*/*.log
116
      - sb_branch.txt
aregimbe's avatar
aregimbe committed
117

118 119 120 121
ubuntu-superbuild-prepare:
  extends: .common-prepare
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
  script:
122
    - ctest -V -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base
123 124 125 126 127

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

130 131 132 133 134 135 136
# TODO: CTT: Include osx-superbuild-prepare here.


##
## SuperBuild builds section.

.superbuild-build:
137
  only: [merge_requests, branches]
138
  extends: .common-build
139 140 141 142 143
  # dependencies:
  #   - superbuild-prepare
  artifacts:
    expire_in: 1 week
    paths:
144
      # - build/*/*/*/*.log
145
      - build_packages/*/*/*/*.log
146
      - build_packages/OTB-*.run
147 148 149

ubuntu-superbuild-build:
  extends: .superbuild-build
150 151
  image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
  script:
152
    - 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
153
    - ctest -VV -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base
154 155
  dependencies:
    - ubuntu-superbuild-prepare
156 157

centos-superbuild-build:
158
  extends: .superbuild-build
159 160
  image: $BUILD_IMAGE_REGISTRY/otb-centos-superbuild-base:6.6
  script:
161
    - 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
162
    - ctest -VV -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-centos-superbuild-base
163
  dependencies:
164
    - centos-superbuild-prepare
165 166

# TODO: CTT: Include osx-superbuild-build here.