.gitlab-ci.yml 2.29 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==1.11.1'
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
    stage: test
    tags: [preprod]
18

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

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

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