.gitlab-ci.yml 4.98 KB
Newer Older
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
1 2 3
# This build file heavily uses template features from YAML so it is generic
# enough for any Bob project. Don't modify it unless you know what you're
# doing.
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
4 5 6 7 8 9 10 11


# Definition of our build pipeline
stages:
  - build
  - test
  - docs
  - wheels
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
12
  - deploy
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
13 14


Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
15 16 17
# ---------
# Templates
# ---------
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
18 19 20 21 22 23 24

# Template for the build stage
# Needs to run on all supported architectures, platforms and python versions
.build_template: &build_job
  stage: build
  before_script:
    - git clean -ffdx
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
25 26 27 28 29
    - mkdir _ci
    - curl --silent "https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/install.sh" > _ci/install.sh
    - chmod 755 _ci/install.sh
    - ./_ci/install.sh _ci #updates
    - ./_ci/before_build.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
30
  script:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
31
    - ./_ci/build.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
32
  after_script:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
33
    - ./_ci/after_build.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
34
  artifacts:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
35
    expire_in: 1 week
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
36
    paths:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
37
      - _ci/
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
38 39 40 41
      - dist/
      - sphinx/


Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
42
# Template for the test stage - re-installs from uploaded wheels
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
43 44 45 46
# Needs to run on all supported architectures, platforms and python versions
.test_template: &test_job
  stage: test
  before_script:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
47 48
    - ./_ci/install.sh _ci #updates
    - ./_ci/before_test.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
49
  script:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
50
    - ./_ci/test.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
51
  after_script:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
52
    - ./_ci/after_test.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
53 54 55


# Template for the wheel uploading stage
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
56
# Needs to run against one supported architecture, platform and python version
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
57 58
.wheels_template: &wheels_job
  stage: wheels
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
59
  environment: intranet
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
60 61
  only:
    - master
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
62
    - /^v\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
63
  before_script:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
64 65
    - ./_ci/install.sh _ci #updates
    - ./_ci/before_wheels.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
66
  script:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
67 68 69
    - ./_ci/wheels.sh
  after_script:
    - ./_ci/after_wheels.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
70 71 72 73 74 75


# Template for (latest) documentation upload stage
# Only one real job needs to do this
.docs_template: &docs_job
  stage: docs
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
76
  environment: intranet
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
77 78 79
  only:
    - master
  before_script:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
    - ./_ci/install.sh _ci #updates
    - ./_ci/before_docs.sh
  script:
    - ./_ci/docs.sh
  after_script:
    - ./_ci/after_docs.sh


# Template for the deployment stage - re-installs from uploaded wheels
# Needs to run on a single architecture only
# Will deploy your package to PyPI and other required services
# Only runs for tags
.deploy_template: &deploy_job
  stage: deploy
  environment: internet
  only:
    - /^v\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
  except:
    - branches
  before_script:
    - ./_ci/install.sh _ci #updates
    - ./_ci/before_deploy.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
102
  script:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
103 104 105
    - ./_ci/deploy.sh
  after_script:
    - ./_ci/after_deploy.sh
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
106 107


Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
108 109 110
# -------------
# Build Targets
# -------------
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
111

Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
112
# Linux + Python 2.7: Builds, tests, uploads wheel and deploys (if needed)
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
113
build_linux_27:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
114
  <<: *build_job
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
115
  variables: &linux_27_build_variables
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
116
    PYTHON_VERSION: "2.7"
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
117 118 119 120 121 122 123 124 125 126 127 128 129 130
    WHEEL_TAG: "py27"
  tags:
    - conda-linux

test_linux_27:
  <<: *test_job
  variables: *linux_27_build_variables
  dependencies:
    - build_linux_27
  tags:
    - conda-linux

wheels_linux_27:
  <<: *wheels_job
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
131 132 133 134 135 136 137 138 139
  variables: *linux_27_build_variables
  dependencies:
    - build_linux_27
  tags:
    - conda-linux

deploy_linux_27:
  <<: *deploy_job
  variables: *linux_27_build_variables
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
140 141 142 143 144 145 146 147
  dependencies:
    - build_linux_27
  tags:
    - conda-linux


# Linux + Python 3.4: Builds and tests
build_linux_34:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
148
  <<: *build_job
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
149
  variables: &linux_34_build_variables
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
150
    PYTHON_VERSION: "3.4"
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
151 152 153 154 155 156 157 158 159 160 161 162 163
    WHEEL_TAG: "py3"
  tags:
    - conda-linux

test_linux_34:
  <<: *test_job
  variables: *linux_34_build_variables
  dependencies:
    - build_linux_34
  tags:
    - conda-linux


Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
164
# Linux + Python 3.5: Builds, tests and uploads wheel
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
165
build_linux_35:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
166
  <<: *build_job
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
167
  variables: &linux_35_build_variables
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
168
    PYTHON_VERSION: "3.5"
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
169 170 171 172 173 174 175 176 177 178 179 180 181 182
    WHEEL_TAG: "py3"
  tags:
    - conda-linux

test_linux_35:
  <<: *test_job
  variables: *linux_35_build_variables
  dependencies:
    - build_linux_35
  tags:
    - conda-linux

wheels_linux_35:
  <<: *wheels_job
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
183
  variables: *linux_35_build_variables
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
184 185 186 187 188 189 190
  dependencies:
    - build_linux_35
  tags:
    - conda-linux

docs_linux_35:
  <<: *docs_job
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
191
  variables: *linux_35_build_variables
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
192 193 194 195 196 197 198 199
  dependencies:
    - build_linux_35
  tags:
    - conda-linux


# Mac OSX + Python 2.7: Builds and tests
build_macosx_27:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
200
  <<: *build_job
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
201
  variables: &macosx_27_build_variables
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
202
    PYTHON_VERSION: "2.7"
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
    WHEEL_TAG: "py27"
  tags:
    - conda-macosx

test_macosx_27:
  <<: *test_job
  variables: *macosx_27_build_variables
  dependencies:
    - build_macosx_27
  tags:
    - conda-macosx


# Mac OSX + Python 3.4: Builds and tests
build_macosx_34:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
218
  <<: *build_job
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
219
  variables: &macosx_34_build_variables
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
220
    PYTHON_VERSION: "3.4"
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
    WHEEL_TAG: "py3"
  tags:
    - conda-macosx

test_macosx_34:
  <<: *test_job
  variables: *macosx_34_build_variables
  dependencies:
    - build_macosx_34
  tags:
    - conda-macosx


# Mac OSX + Python 3.5: Builds and tests
build_macosx_35:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
236
  <<: *build_job
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
237
  variables: &macosx_35_build_variables
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
238
    PYTHON_VERSION: "3.5"
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
239 240 241 242 243 244 245 246 247 248
    WHEEL_TAG: "py3"
  tags:
    - conda-macosx

test_macosx_35:
  <<: *test_job
  variables: *macosx_35_build_variables
  dependencies:
    - build_macosx_35
  tags:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
249
    - conda-macosx