.gitlab-ci.yml 1.41 KB
Newer Older
1 2 3 4 5 6
stages:
  - test
  - syntaxe
  - doc
  - deploy

Florent Chehab's avatar
Florent Chehab committed
7 8 9 10 11 12
variables:
  ENV: CI
  POSTGRES_DB: outgoing
  POSTGRES_USER: outgoing
  POSTGRES_PASSWORD: ""

Florent Chehab's avatar
Florent Chehab committed
13 14
testing:
  stage: test
Florent Chehab's avatar
Florent Chehab committed
15 16 17
  image: python:3.6.5-jessie
  services:
    - postgres:9.6.8
Florent Chehab's avatar
Florent Chehab committed
18
  script:
19 20 21
    - make install_backend
    - make check_backend
    - make test_backend_server
Florent Chehab's avatar
Florent Chehab committed
22 23 24 25 26 27 28
  artifacts:
    paths:
      - htmlcov/
    expire_in: 1 month
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
29
flake8:
30
  stage: syntaxe
Florent Chehab's avatar
Florent Chehab committed
31
  image: python:3.6.5-jessie
Florent Chehab's avatar
Florent Chehab committed
32
  script:
Florent Chehab's avatar
clean  
Florent Chehab committed
33
    - pip install flake8
Florent Chehab's avatar
Florent Chehab committed
34 35 36 37
    - flake8
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
38
pages:
39 40
  stage: doc
  image: floawfloaw/plantuml
Florent Chehab's avatar
Florent Chehab committed
41 42 43
  dependencies:
    - testing
  script:
44 45
    - mkdir .public
    - mv htmlcov/ .public/coverage
46
    - make docs
47 48
    - mv docs/ .public/docs
    - mv .public public
Florent Chehab's avatar
Florent Chehab committed
49 50 51 52
  artifacts:
    paths:
      - public
    expire_in: 1 month
Florent Chehab's avatar
Florent Chehab committed
53 54
  only: 
    - master
Florent Chehab's avatar
Florent Chehab committed
55 56
  tags:
    - docker
Florent Chehab's avatar
Florent Chehab committed
57

Florent Chehab's avatar
Florent Chehab committed
58
deliver_for_production:
Florent Chehab's avatar
Florent Chehab committed
59
  type: deploy
Florent Chehab's avatar
Florent Chehab committed
60 61 62 63 64 65 66 67 68
  before_script:
    ## look here for info : https://docs.gitlab.com/ee/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - chmod 644 ~/.ssh/known_hosts
Florent Chehab's avatar
Florent Chehab committed
69
  script:
Florent Chehab's avatar
Florent Chehab committed
70
    - ssh $SERVER_USER_USERNAME@$SERVER 'bash -s' < deploy.sh
Florent Chehab's avatar
Florent Chehab committed
71
  only:
Florent Chehab's avatar
Florent Chehab committed
72
    - production 
Florent Chehab's avatar
Florent Chehab committed
73
  tags:
Florent Chehab's avatar
Florent Chehab committed
74 75
    - docker