variables:
  DOCKER_DRIVER: overlay2
  GIT_DEPTH: "3"

stages:
  - build

.general:
  retry:
    max: 2
    when:
      - runner_system_failure
      - stuck_or_timeout_failure

native-build:
  extends: .general
  only: [merge_requests]
  stage: build
  image: registry.orfeo-toolbox.org/gbonnefille/otb-build-env/otb-ubuntu-native:18.04
  script:
    - ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-gcc

build:ubuntu-llvm:
  extends: .general
  stage: build
  image: registry.orfeo-toolbox.org/gbonnefille/otb-build-env/otb-ubuntu-shark:18.04
  script:
    - ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-shark

variables:
  DOCKER_DRIVER: overlay2
  GIT_DEPTH: "3"
  GIT_CHECKOUT: "false"

# Git checkout is disabled to let us handle efficiently the Git-LFS
before_script:
  - git lfs fetch origin $CI_COMMIT_REF_NAME
  - git checkout $CI_COMMIT_REF_NAME

stages:
  - build

.general:
  retry:
    max: 2
    when:
      - runner_system_failure
      - stuck_or_timeout_failure

native-build:
  extends: .general
  only: [merge_requests]
  stage: build
  image: registry.orfeo-toolbox.org/gbonnefille/otb-build-env/otb-ubuntu-native:18.04
  script:
    - ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-gcc

build:ubuntu-llvm:
  extends: .general
  stage: build
  image: registry.orfeo-toolbox.org/gbonnefille/otb-build-env/otb-ubuntu-shark:18.04
  script:
    - ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-shark

Handle manually the checkout step
Handle manually the checkout step

Currently, `git lfs checkout` is much more efficient to download LFS data
than `git checkout` (50s / 4min).
