.gitlab-ci.yml 1.11 KB
Newer Older
1
job test python:
okhin's avatar
okhin committed
2 3 4 5 6 7
    environment:
        preprod
    script:
        - virtualenv --python=python3 env
        - source env/bin/activate
        - pip install coverage
okhin's avatar
okhin committed
8 9
        - python setup.py develop
        - cp picampaign/settings.py.sample picampaign/settings.py
okhin's avatar
okhin committed
10
        - ${VIRTUAL_ENV}/bin/coverage run --source='.' manage.py test
okhin's avatar
okhin committed
11
        - ${VIRTUAL_ENV}/bin/coverage report --omit="${VIRTUAL_ENV}/*",'*__init__.py'
okhin's avatar
okhin committed
12 13 14 15
    stage: test
    tags: [preprod]
    only:
        - master
okhin's avatar
okhin committed
16 17 18 19 20 21 22 23 24 25 26 27 28

job deploy:
    environment:
        preprod
    variables:
        GIT_DIR: '/srv/piphone/campaign/.git'
        GIT_WORK_DIR: '/srv/piphone/campaign/'
    script:
        - git pull origin master
        - source /srv/piphone/campaign/env/bin/activate
        - pip install --upgrade pip
        - python /srv/piphone/campaign/setup.py install
        - python /srv/piphone/campaign/manage.py migrate
okhin's avatar
okhin committed
29
        - python /srv/piphone/campaign/manage.py collectstatic --noinput
okhin's avatar
okhin committed
30 31
        - python /srv/piphone/campaign/manage.py compilemessages
        - touch /srv/piphone/campaign.ready
okhin's avatar
okhin committed
32
    stage: deploy
okhin's avatar
okhin committed
33 34 35
    tags: [preprod]
    only:
        - master