.gitlab-ci.yml 6.53 KB
Newer Older
1 2 3


before_script:
Mathieu Giraud's avatar
Mathieu Giraud committed
4
  - make demo
5 6
  - make data
  - make germline
7
  - make -C browser sha1
8
  - cp -p doc/analysis-example.vidjil browser/
9 10

stages:
11
  - test_tools
12
  - test_quality
13
  - test_unit
14
  - deploy_review
15
  - test_germlines
16
  - test_functional
17
  - test_functional_external
18
  - test_shouldvdj
19
  - coverage
20
  - prepare_release
21
  - release
Mathieu Giraud's avatar
Mathieu Giraud committed
22 23
  - valgrind_unit
  - valgrind_functional
24
  - multiple_tests
25
  - prepare_deploy
26
  - deploy_prod
27

28 29 30 31 32 33 34
# Anchors

.coverage_dependency: &lcov_artifact
  artifacts:
    paths:
      - algo/lcov_test_*.filtered
    expire_in: 6hrs
35

36 37 38 39 40 41
# Tools

test_tools:
  stage: test_tools
  script: make -C tools/tests

42 43 44 45 46 47 48

# Germlines

test_germlines:
  stage: test_germlines
  script:
    - make -C germline get-all-data
49
    - make -C germline tests
50
  only:
51
    - /^feature-.*g.*\/.*$/
52 53


Mathieu Giraud's avatar
Mathieu Giraud committed
54
# Algorithm
55 56 57

test_algo_unit:
  stage: test_unit
58 59
  script: make -C algo unit_coverage
  <<: *lcov_artifact
60
  only:
61
    - /^feature-.*a.*\/.*$/
62

63 64
test_algo_should:
  stage: test_functional
65
  script: make -C algo should_coverage
66
  only:
67
    - /^feature-.*a.*\/.*$/
68
  <<: *lcov_artifact
69 70 71

test_algo_shouldvdj:
  stage: test_shouldvdj
72 73
  script: make -C algo shouldvdj_coverage
  <<: *lcov_artifact
74 75 76 77 78
  only:
    - /^feature-.*a.*\/.*$/

algo_coverage:
  stage: coverage
79
  coverage: /^\s*lines\.*:\s+([0-9.]+\%)/
80 81 82
  script:
    - make -C algo lcov_reports
    - mv algo/reports/ coverage
83 84
  artifacts:
    paths:
85
      - coverage/
86
  only:
87
    - /^feature-.*a.*\/.*$/
88

Mathieu Giraud's avatar
Mathieu Giraud committed
89 90
algo_valgrind_unit:
  stage: valgrind_unit
91
  script: make -C algo valgrind_unit
Mathieu Giraud's avatar
Mathieu Giraud committed
92
  only:
93
    - /^feature-.*a.*\/.*$/
94 95
  tags:
    - valgrind
Mathieu Giraud's avatar
Mathieu Giraud committed
96 97 98

algo_valgrind_functional:
  stage: valgrind_functional
99
  script: make -C algo valgrind_should
Mathieu Giraud's avatar
Mathieu Giraud committed
100 101
  when: manual
  only:
102
    - /^feature-.*a.*\/.*$/
103 104
  tags:
    - valgrind
Mathieu Giraud's avatar
Mathieu Giraud committed
105

106 107 108 109 110
prepare_release:
  stage: prepare_release
  script: make -C algo release RELEASE_TAG='rc'
  when: manual
  only:
111
    - /^feature-.*a.*\/.*$/
112

113 114 115 116 117
release:
  stage: release
  script: make -C algo release RELEASE_TAG=`cat algo/release`
  when: manual
  only:
118
    - /^feature-.*a.*\/release$/
119
  artifacts:
120
    paths:
121 122
    - algo/releases/vidjil-algo-`cat algo/release`.tar.gz
    - algo/releases/vidjil-algo-`cat algo/release`/vidjil-algo-`cat algo/release`_`uname -m`
123
  allow_failure: false
124 125
  tags:
    - ubuntu-16.04-amd64
126

127 128 129 130 131 132 133 134 135 136
copy_release:
  stage: prepare_deploy
  script:
    - |
      for repo in $ALGO_REPOSITORIES; do
        echo "Copying release to $repo"
        scp algo/releases/vidjil-algo*.tar.gz algo/releases/vidjil-algo*/vidjil-algo-*_* $repo
      done
      release_name=$(cat algo/release)
      ssh $VIDJIL_WWW "cd /var/www/html/releases; ln -sf vidjil-algo-${release_name}.tar.gz vidjil-latest.tgz; ln -sf vidjil-algo-${release_name}_x86_64 vidjil-latest_x86_64"
Mikaël Salson's avatar
Mikaël Salson committed
137
      ssh $VIDJIL_BONSAI "cd /bio1/www/html/vidjil; scp vidjil-algo-${release_name}* $VIDJIL_BONSAI_PROD:/bio1/www/html/vidjil"
138 139 140
  only:
    - /^feature-.*a.*\/release$/

141 142 143 144 145 146 147
deploy_release_prod:
  stage: deploy_prod
  only:
    - /^feature-.*a.*\/release$/
  script:
    - |
      release_name=$(cat algo/release)
148
      ssh $DEPLOY_SERVER "cd releases/vidjil;\
149
          tar xvzf vidjil-algo-${release_name}.tar.gz;\
150 151
          make -C vidjil-algo-${release_name};\
          ln -sfT vidjil-algo-${release_name} next"
152

153 154
.testing-compilers: &test_various_compilers
  stage: multiple_tests
155 156 157 158 159 160 161 162 163 164 165 166
  tags:
    - several-compilers
  script:
    - |
      for CXX in $COMPILERS; do
        echo "**** Using $CXX for compilation ****"
        make -C algo clean
        make -C algo CXX=$CXX unit
        make -C algo CXX=$CXX should
        make -C algo CXX=$CXX valgrind_unit
      done

167 168 169 170 171 172 173 174 175 176 177
test_various_compilers_manual:
  <<: *test_various_compilers
  when: manual
  only:
    - /^feature-.*a.*\/.*$/

test_various_compilers_release:
  <<: *test_various_compilers
  only:
    - /^feature-.*a.*\/release$/

178

Mathieu Giraud's avatar
Mathieu Giraud committed
179
# Client
180

181
test_browser_unit:
182
  stage: test_unit
Mathieu Giraud's avatar
Mathieu Giraud committed
183
  script: make unit_browser
184 185 186
  artifacts:
    paths:
    - browser/
187
  only:
188 189
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
Mathieu Giraud's avatar
Mathieu Giraud committed
190
    - prod-client
191
    - dev
192 193
  tags:
    - web
194

195 196
test_browser-functional:
  stage: test_functional
197 198 199 200
  script:
    - make -C browser
    - source /etc/profile.d/rvm.sh
    - rvm use 2.1.1
201 202 203 204 205
    - HEADLESS=1 make -C browser/test functional
  artifacts:
    paths:
    - browser/
  only:
206 207
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
208
    - prod-client
209 210
  tags:
    - web
211 212 213

test_browser-functional-external:
  stage: test_functional_external
214
  retry: 2
215 216 217 218 219
  script:
    - make -C browser
    - source /etc/profile.d/rvm.sh
    - rvm use 2.1.1
    - HEADLESS=1 make -C browser/test external
220 221 222
  artifacts:
    paths:
    - browser/
223
  only:
224 225
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
Mathieu Giraud's avatar
Mathieu Giraud committed
226
    - prod-client
227 228
  tags:
    - web
229

230 231
code_quality:
  stage: test_quality
232
  script: make -C browser quality
233
  only:
234 235
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
236
    - prod-client
237
    - dev
238 239
  tags:
    - web
240

Ryan Herbert's avatar
Ryan Herbert committed
241 242 243 244 245
# Server

test_server_unit:
    stage: test_unit
    script:
246 247
      - virtualenv $CI_BUILD_REF_SLUG
      - source $CI_BUILD_REF_SLUG/bin/activate
248
      - pip install -r requirements.txt
Ryan Herbert's avatar
Ryan Herbert committed
249
      - make -C server install_web2py_standalone
250
      - make -C server launch_fuse_server
251
      - make unit_server || (make -C server kill_fuse_server; deactivate; false)
Ryan Herbert's avatar
Ryan Herbert committed
252
      - make -C server kill_fuse_server
253
      - deactivate
Ryan Herbert's avatar
Ryan Herbert committed
254
    only:
255 256
      - /^feature-.*s.*\/.*$/
      - /^hotfix-.*s.*\/.*$/
Ryan Herbert's avatar
Ryan Herbert committed
257 258 259 260 261 262 263
      - prod-server
      - dev
    tags:
      - web

# Deployment

264 265
deploy_review:
  stage: deploy_review
266
  script:
267
    - make -C browser icons
268
    - echo "$REVIEW_CONFIG_JS" > browser/js/conf.js
269
    - rsync -av --delete browser $DEPLOY_SERVER:$DEPLOY_SERVER_PATH$CI_BUILD_REF_SLUG
270
  environment:
271
    name: review/$CI_BUILD_REF_NAME
Mikaël Salson's avatar
Mikaël Salson committed
272
    url: http://$CI_BUILD_REF_SLUG.ci.vidjil.org/?data=analysis-example.vidjil
Mathieu Giraud's avatar
Mathieu Giraud committed
273
    on_stop: stop_deploy_review
274
  only:
275 276
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
277 278
  tags:
    - web
279

280
deploy_prod:
281
  stage: deploy_prod
282
  script:
283 284 285 286 287 288 289
    - ssh $PROD_CLIENT_SERVER "
         cd $PROD_CLIENT_PATH;
         git fetch
         && git reset --hard origin/prod-client
         && make -C browser
         && make -C browser sha1
         && cp doc/analysis-example.vidjil browser/"
290 291
  environment:
    name: production
292
    url: http://$PROD_CLIENT_SERVER/?data=analysis-example.vidjil
293 294
  only:
    - prod-client
295 296
  tags:
    - web
297

298 299
stop_deploy_review:
  stage: deploy_review
300 301 302 303 304 305
  variables:
    GIT_STRATEGY: none
  script:
    - ssh $DEPLOY_SERVER "rm -rf $DEPLOY_SERVER_PATH$CI_BUILD_REF_SLUG"
  when: manual
  environment:
306
    name: review/$CI_BUILD_REF_NAME
307
    action: stop
308
  only:
309 310
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
311
  tags:
312
    - web