.gitlab-ci.yml 2.25 KB
Newer Older
okhin's avatar
okhin committed
1 2 3 4 5
stages:
    - test
    - build
    - deploy

6
job test python:
okhin's avatar
okhin committed
7 8 9
    script:
        - virtualenv --python=python3 env
        - source env/bin/activate
10
        - pip install django
okhin's avatar
okhin committed
11
        - pip install coverage
12 13
        - python setup.py develop
        - cp picampaign/settings.py.sample picampaign/settings.py
okhin's avatar
okhin committed
14
        - ${VIRTUAL_ENV}/bin/coverage run --source='.' manage.py test
15
        - ${VIRTUAL_ENV}/bin/coverage report --omit="${VIRTUAL_ENV}/*",'*__init__.py'
okhin's avatar
okhin committed
16 17 18 19
    stage: test
    tags: [preprod]
    only:
        - master
20

21 22
job build:
    script:
23
        - virtualenv --python=python3 env
24
        - source env/bin/activate
25 26
        - pip install django
        - pip install coverage
27 28 29
        - python setup.py develop
        - cp picampaign/settings.py.sample picampaign/settings.py
        - python manage.py collectstatic --noinput
okhin's avatar
okhin committed
30 31 32
        - python manage.py makemessages --exclude env --locale fr
        - python manage.py makemessages --exclude env --locale en
        - python manage.py makemessages --exclude env --locale de
33 34 35 36 37 38 39 40 41 42 43
    artifacts:
        paths:
            - campaign/static
            - campaign/locale
        expire_in: 1 day
    stage: build
    tags: [preprod]
    only:
        - master

job deploy preprod:
44 45 46
    environment:
        preprod
    variables:
47
        BASE_DIR: /srv/piphone/campaign
48
    script:
49
        - rsync -ruvC ./ ${BASE_DIR}
50
        - virtualenv --python=python3 ${BASE_DIR}/env
okhin's avatar
okhin committed
51
        - source ${BASE_DIR}/env/bin/activate
52 53
        - pip install django
        - pip install coverage
54 55 56
        - python /srv/piphone/campaign/setup.py install
        - python /srv/piphone/campaign/manage.py migrate
        - touch /srv/piphone/campaign.ready
57
    stage: deploy
58 59 60
    tags: [preprod]
    only:
        - master
okhin's avatar
okhin committed
61 62 63 64 65

job deploy prod:
    environment:
        prod
    variables:
okhin's avatar
okhin committed
66
        BASE_DIR: /srv/piphone/campaign
okhin's avatar
okhin committed
67
    script:
68
        - rsync -ruvC ./ ${BASE_DIR}
69
        - virtualenv --python=python3 ${BASE_DIR}/env
okhin's avatar
okhin committed
70
        - source ${BASE_DIR}/env/bin/activate
71 72
        - pip install django
        - pip install coverage
okhin's avatar
okhin committed
73 74
        - python /srv/piphone/campaign/setup.py install
        - python /srv/piphone/campaign/manage.py migrate
okhin's avatar
okhin committed
75
        - touch /srv/piphone/campaign/ready
okhin's avatar
okhin committed
76 77 78 79
    stage: deploy
    tags: [piphone]
    only:
        - master
okhin's avatar
okhin committed
80
    when: manual