.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
okhin's avatar
okhin committed
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
okhin's avatar
okhin committed
15
        - ${VIRTUAL_ENV}/bin/coverage report --omit="${VIRTUAL_ENV}/*",'*__init__.py'
okhin's avatar
okhin committed
16
17
    stage: test
    tags: [preprod]
okhin's avatar
okhin committed
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:
Okhin's avatar
Okhin committed
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:
okhin's avatar
okhin committed
42
43
44
    environment:
        preprod
    variables:
45
        BASE_DIR: /srv/piphone/campaign
okhin's avatar
okhin committed
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
okhin's avatar
okhin committed
52
53
54
        - python /srv/piphone/campaign/setup.py install
        - python /srv/piphone/campaign/manage.py migrate
        - touch /srv/piphone/campaign.ready
okhin's avatar
okhin committed
55
    stage: deploy
okhin's avatar
okhin committed
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