.gitlab-ci.yml 2.42 KB
Newer Older
Timm Fitschen's avatar
Timm Fitschen committed
1
2
3
4
5
6
#
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
7
# Copyright (C) 2019 Henrik tom Wörden
Timm Fitschen's avatar
Timm Fitschen committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# ** end header
#
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
24

Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
25
variables:
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
26
   CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-webui-testenv
Henrik tom Wörden's avatar
Henrik tom Wörden committed
27
   # With dind the docker deamon is available on the network 
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
28
29
30
31
32
33
34
35
   DOCKER_HOST: tcp://docker:2375/
   # When using dind, it's wise to use the overlayfs driver for
   # improved performance.
   DOCKER_DRIVER: overlay2

services:
   - docker:dind

Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
36
image: $CI_REGISTRY_IMAGE:latest
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
37

Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
38

Timm Fitschen's avatar
Timm Fitschen committed
39
stages:
40
41
42
43
  - setup
  - linting
  - test
  - deploy
Timm Fitschen's avatar
Timm Fitschen committed
44

45
46
# run qunit tests and pylint
test:
47
  tags: [ docker ]
48
49
50
51
52
53
54
55
  stage: test
  artifacts:
    paths:
      - public/qunit.log
      - screenlog.*
  script:
    - make pylint
    - make run-qunit
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
56
          
57
# Trigger building of server image and integration tests
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
58
trigger_build:
59
  tags: [ docker ]
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
60
61
  stage: deploy
  script:
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
62
    - echo $TOKEN     
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
63
64
    - /usr/bin/curl -X POST
       -F token=$TOKEN
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
65
       -F "variables[WEBUI]=$CI_COMMIT_REF_NAME"
66
       -F "variables[TriggerdBy]=WEBUI"
67
       -F "variables[TriggerdByHash]=$CI_COMMIT_SHORT_SHA"
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
68
       -F ref=master https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
69

70
# Build a docker image in which tests for this repository can run
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
71
build-testenv:
72
  tags: [ docker ]
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
73
    image: docker:latest
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
74
75
76
77
78
79
80
    stage: setup
    script: 
        - cd test/docker
        - docker login -u testuser -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
          # use here general latest or specific branch latest...
        - docker pull $CI_REGISTRY_IMAGE:latest || true
        - docker build 
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
81
          --pull
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
82
83
84
          --cache-from $CI_REGISTRY_IMAGE:latest 
          -t $CI_REGISTRY_IMAGE:latest .
        - docker push $CI_REGISTRY_IMAGE:latest