.gitlab-ci.yml 6.33 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
  - prepare_deploy
25
  - deploy_prod
26

27 28 29 30 31 32 33
# Anchors

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

35 36 37 38 39 40
# Tools

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

41 42 43 44 45 46 47

# Germlines

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


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

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

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

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

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

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

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

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

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

126 127 128 129 130 131 132 133 134 135
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
136
      ssh $VIDJIL_BONSAI "cd /bio1/www/html/vidjil; scp vidjil-algo-${release_name}* $VIDJIL_BONSAI_PROD:/bio1/www/html/vidjil"
137 138 139
  only:
    - /^feature-.*a.*\/release$/

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

152 153
test_various_compilers:
  stage: test_functional
154
  when: manual
155
  only:
156
    - /^feature-.*a.*\/.*$/
157 158 159 160 161 162 163 164 165 166 167 168 169
  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


Mathieu Giraud's avatar
Mathieu Giraud committed
170
# Client
171

172
test_browser_unit:
173
  stage: test_unit
Mathieu Giraud's avatar
Mathieu Giraud committed
174
  script: make unit_browser
175 176 177
  artifacts:
    paths:
    - browser/
178
  only:
179 180
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
Mathieu Giraud's avatar
Mathieu Giraud committed
181
    - prod-client
182
    - dev
183 184
  tags:
    - web
185

186 187
test_browser-functional:
  stage: test_functional
188 189 190 191
  script:
    - make -C browser
    - source /etc/profile.d/rvm.sh
    - rvm use 2.1.1
192 193 194 195 196
    - HEADLESS=1 make -C browser/test functional
  artifacts:
    paths:
    - browser/
  only:
197 198
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
199
    - prod-client
200 201
  tags:
    - web
202 203 204

test_browser-functional-external:
  stage: test_functional_external
205
  retry: 2
206 207 208 209 210
  script:
    - make -C browser
    - source /etc/profile.d/rvm.sh
    - rvm use 2.1.1
    - HEADLESS=1 make -C browser/test external
211 212 213
  artifacts:
    paths:
    - browser/
214
  only:
215 216
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
Mathieu Giraud's avatar
Mathieu Giraud committed
217
    - prod-client
218 219
  tags:
    - web
220

221 222
code_quality:
  stage: test_quality
223
  script: make -C browser quality
224
  only:
225 226
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
227
    - prod-client
228
    - dev
229 230
  tags:
    - web
231

Ryan Herbert's avatar
Ryan Herbert committed
232 233 234 235 236
# Server

test_server_unit:
    stage: test_unit
    script:
237 238
      - virtualenv $CI_BUILD_REF_SLUG
      - source $CI_BUILD_REF_SLUG/bin/activate
239
      - pip install -r requirements.txt
Ryan Herbert's avatar
Ryan Herbert committed
240
      - make -C server install_web2py_standalone
241
      - make -C server launch_fuse_server
242
      - make unit_server || (make -C server kill_fuse_server; deactivate; false)
Ryan Herbert's avatar
Ryan Herbert committed
243
      - make -C server kill_fuse_server
244
      - deactivate
Ryan Herbert's avatar
Ryan Herbert committed
245
    only:
246 247
      - /^feature-.*s.*\/.*$/
      - /^hotfix-.*s.*\/.*$/
Ryan Herbert's avatar
Ryan Herbert committed
248 249 250 251 252 253 254
      - prod-server
      - dev
    tags:
      - web

# Deployment

255 256
deploy_review:
  stage: deploy_review
257
  script:
258
    - make -C browser icons
259
    - echo "$REVIEW_CONFIG_JS" > browser/js/conf.js
260
    - rsync -av --delete browser $DEPLOY_SERVER:$DEPLOY_SERVER_PATH$CI_BUILD_REF_SLUG
261
  environment:
262
    name: review/$CI_BUILD_REF_NAME
Mikaël Salson's avatar
Mikaël Salson committed
263
    url: http://$CI_BUILD_REF_SLUG.ci.vidjil.org/?data=analysis-example.vidjil
Mathieu Giraud's avatar
Mathieu Giraud committed
264
    on_stop: stop_deploy_review
265
  only:
266 267
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
268 269
  tags:
    - web
270

271
deploy_prod:
272
  stage: deploy_prod
273
  script:
274 275 276 277 278 279 280
    - 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/"
281 282
  environment:
    name: production
283
    url: http://$PROD_CLIENT_SERVER/?data=analysis-example.vidjil
284 285
  only:
    - prod-client
286 287
  tags:
    - web
288

289 290
stop_deploy_review:
  stage: deploy_review
291 292 293 294 295 296
  variables:
    GIT_STRATEGY: none
  script:
    - ssh $DEPLOY_SERVER "rm -rf $DEPLOY_SERVER_PATH$CI_BUILD_REF_SLUG"
  when: manual
  environment:
297
    name: review/$CI_BUILD_REF_NAME
298
    action: stop
299
  only:
300 301
    - /^feature-.*c.*\/.*$/
    - /^hotfix-.*c.*\/.*$/
302
  tags:
303
    - web