.gitlab-ci.yml 6.81 KB
Newer Older
Hervé  MENAGER's avatar
Hervé MENAGER committed
1
2
3
stages:
  - test
  - deploy
Hervé  MENAGER's avatar
Hervé MENAGER committed
4

5
6
7
8
test-style:
  image: python:3.6
  stage: test
  script:
9
  - apt update && apt install -y apache2-dev graphviz graphviz-dev
10
  - cd ippisite
Bryan  BRANCOTTE's avatar
Bryan BRANCOTTE committed
11
  - pip install flake8
12
  - flake8 --config=.flake8 
Hervé  MENAGER's avatar
Hervé MENAGER committed
13

14
15
16
17
18
19
20
test-ansible:
    image: python:3.5
    stage: test
    script:
      - pip3.5 install ansible
      - cd ansible
      - whoami
21
      - ansible-galaxy collection install ansible.posix
22
23
      - ansible-playbook system.yaml --syntax-check 
      - ansible-playbook deploy.yaml --syntax-check 
Hervé  MENAGER's avatar
Hervé MENAGER committed
24

25
test-centos7:
26
27
  services:
    - redis  
Hervé  MENAGER's avatar
Hervé MENAGER committed
28
29
30
  image: centos:centos7
  stage: test
  script:
31
  - yum install -y https://repo.ius.io/ius-release-el7.rpm
32
  - yum update -y
Hervé  MENAGER's avatar
Hervé MENAGER committed
33
  - yum install -y python36u python36u-pip python36u-devel
Hervé  MENAGER's avatar
Hervé MENAGER committed
34
  - yum install -y gcc graphviz graphviz-devel
Hervé  MENAGER's avatar
Hervé MENAGER committed
35
  - yum install -y postgresql-devel
36
  - yum install -y httpd httpd-devel
Hervé  MENAGER's avatar
Hervé MENAGER committed
37
  - yum install -y gcc-c++ make
Hervé  MENAGER's avatar
Hervé MENAGER committed
38
  - yum install -y wget
39
  #- yum install -y desktop-file-utils inchi-devel libxml2-devel swig wxGTK-devel ImageMagick perl-devel perl-generators
40
  - yum install -y git
41
  - yum install -y swig # openbabel pip dep
42
  - yum install -y wxBase wxGTK inchi boost-iostreams boost-regex boost-system  #openbabel rpm deps
43
44
45
46
  - wget https://gitlab.pasteur.fr/hub/openbabel4ippidb/raw/master/rpmbuild/RPMS/x86_64/openbabel-libs-3.0.0-1.py3.el7.x86_64.rpm
  - wget https://gitlab.pasteur.fr/hub/openbabel4ippidb/raw/master/rpmbuild/RPMS/x86_64/openbabel-devel-3.0.0-1.py3.el7.x86_64.rpm
  - wget https://gitlab.pasteur.fr/hub/openbabel4ippidb/raw/master/rpmbuild/RPMS/x86_64/openbabel-3.0.0-1.py3.el7.x86_64.rpm
  - wget https://gitlab.pasteur.fr/hub/openbabel4ippidb/raw/master/rpmbuild/RPMS/x86_64/python3-openbabel-3.0.0-1.py3.el7.x86_64.rpm
47
  - rpm -Uvh *.rpm
48
  - export BABEL_LIBDIR=/usr/lib64/openbabel
49
50
51
52
53
54
55
  - wget https://www.sqlite.org/2019/sqlite-autoconf-3280000.tar.gz
  - tar xvfz sqlite-autoconf-3280000.tar.gz
  - cd sqlite-autoconf-3280000/
  - ./configure
  - make
  - make install
  - cd -
Hervé  MENAGER's avatar
Hervé MENAGER committed
56
  - sqlite3 --version
57
  - export LD_LIBRARY_PATH="/usr/local/lib"
Hervé  MENAGER's avatar
Hervé MENAGER committed
58
  - cd ippisite
59
60
  - pip3.6 install -r requirements-dev.txt
  - python3.6 manage.py test
61
  - coverage run --source='.' manage.py test
62
  - coverage report
63
64
  - coverage html
  - pip3.6 install sphinx sphinx-argparse sphinxcontrib.bibtex sphinx_rtd_theme
65
  - cd docs
66
  - PYTHON=python3.6 make html
Hervé  MENAGER's avatar
Hervé MENAGER committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  artifacts:
    paths:
      - ippisite/htmlcov
      - ippisite/docs/build/html

pages:
  stage: deploy
  dependencies:
    - test-centos7
  script:
    - 'mkdir -p public/$CI_COMMIT_REF_NAME'
    - 'mv ippisite/htmlcov public/$CI_COMMIT_REF_NAME/' 
    - 'mv ippisite/docs/build/html/ public/$CI_COMMIT_REF_NAME/'
  artifacts:
    paths:
82
      - public
83

Fabien  MAREUIL's avatar
Fabien MAREUIL committed
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
deploy-webserver-targetcentric:
  image: python:3.5
  stage: deploy
  before_script:
    # install ssh-agent
    - 'which ssh-agent || ( yum -y install openssh-clients )'
    # run ssh-agent
    - eval $(ssh-agent -s)
    # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
    - echo "$SSH_PRIVATE_KEY_targetcentric" | tr -d '\r' | ssh-add -
    # disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)
    # WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config
    - mkdir -p ~/.ssh
    - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
  script:
    - pip3.5 install ansible
    - cd ansible
    - whoami
102
    - ansible-galaxy collection install ansible.posix
Fabien  MAREUIL's avatar
Fabien MAREUIL committed
103
    - ansible-playbook -vvv -i ./hosts_master deploy.yaml 
104
      --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf marvinjs_apikey=$MARVINJS_APIKEY_targetcentric galaxy_base_url=$GALAXY_BASE_URL_targetcentric galaxy_apikey=$GALAXY_APIKEY_targetcentric galaxy_compoundproperties_workflowid=$GALAXY_COMPOUNDPROPERTIES_WORKFLOWID_targetcentric secret_key=$SECRET_KEY_targetcentric dbname=$DBNAME_targetcentric dbuser=$DBUSER_targetcentric dbpassword=$DBPASSWORD_targetcentric dbhost=$DBHOST_targetcentric dbport=$DBPORT_targetcentric http_port=$HTTP_PORT_targetcentric branch=$CI_COMMIT_REF_NAME gacode=$GACODE_targetcentric ippidb_media=$IPPIDB_MEDIA_targetcentric"
Fabien  MAREUIL's avatar
Fabien MAREUIL committed
105
106
  only:
    - targetcentric
Hervé  MENAGER's avatar
Hervé MENAGER committed
107

108
deploy-webserver-test:
109
  image: python:3.5
Hervé  MENAGER's avatar
Hervé MENAGER committed
110
  stage: deploy
Hervé  MENAGER's avatar
Hervé MENAGER committed
111
112
113
114
115
116
  before_script:
    # install ssh-agent
    - 'which ssh-agent || ( yum -y install openssh-clients )'
    # run ssh-agent
    - eval $(ssh-agent -s)
    # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
117
    - echo "$SSH_PRIVATE_KEY_master" | tr -d '\r' | ssh-add -
Hervé  MENAGER's avatar
Hervé MENAGER committed
118
119
120
121
    # disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)
    # WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config
    - mkdir -p ~/.ssh
    - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
Hervé  MENAGER's avatar
Hervé MENAGER committed
122
  script:
123
    - pip3.5 install ansible
Hervé  MENAGER's avatar
Hervé MENAGER committed
124
    - cd ansible
Hervé  MENAGER's avatar
Hervé MENAGER committed
125
    - whoami
126
    - ansible-galaxy collection install ansible.posix
127
    - ansible-playbook -vvv -i ./hosts_master deploy.yaml 
128
      --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf marvinjs_apikey=$MARVINJS_APIKEY_master galaxy_base_url=$GALAXY_BASE_URL_master galaxy_apikey=$GALAXY_APIKEY_master galaxy_compoundproperties_workflowid=$GALAXY_COMPOUNDPROPERTIES_WORKFLOWID_master secret_key=$SECRET_KEY_master dbname=$DBNAME_master dbuser=$DBUSER_master dbpassword=$DBPASSWORD_master dbhost=$DBHOST_master dbport=$DBPORT_master http_port=$HTTP_PORT_master branch=$CI_COMMIT_REF_NAME gacode=$GACODE_master ippidb_media=$IPPIDB_MEDIA_master"
129
  only:
130
    - master
Hervé  MENAGER's avatar
Hervé MENAGER committed
131

132
133
134
135
136
137
138
139
140
deploy-webserver-production:
  image: python:3.5
  stage: deploy
  before_script:
    # install ssh-agent
    - 'which ssh-agent || ( yum -y install openssh-clients )'
    # run ssh-agent
    - eval $(ssh-agent -s)
    # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
141
    - echo "$SSH_PRIVATE_KEY_release" | tr -d '\r' | ssh-add -
142
143
144
145
146
147
148
149
    # disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)
    # WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config
    - mkdir -p ~/.ssh
    - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
  script:
    - pip3.5 install ansible
    - cd ansible
    - whoami
150
    - ansible-galaxy collection install ansible.posix
151
    - ansible-playbook -vvv -i ./hosts_release deploy.yaml 
152
      --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf marvinjs_apikey=$MARVINJS_APIKEY_release galaxy_base_url=$GALAXY_BASE_URL_release galaxy_apikey=$GALAXY_APIKEY_release galaxy_compoundproperties_workflowid=$GALAXY_COMPOUNDPROPERTIES_WORKFLOWID_release secret_key=$SECRET_KEY_release dbname=$DBNAME_release dbuser=$DBUSER_release dbpassword=$DBPASSWORD_release dbhost=$DBHOST_release dbport=$DBPORT_release http_port=$HTTP_PORT_release branch=$CI_COMMIT_REF_NAME  gacode=$GACODE_release ippidb_media=$IPPIDB_MEDIA_release"
153
  only:
Bryan  BRANCOTTE's avatar
Bryan BRANCOTTE committed
154
    - release