.gitlab-ci.yml 1.09 KB
Newer Older
okhin's avatar
okhin committed
1
2
3
4
5
variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"

cache:
    paths:
6
7
        - "pip-cache"
        - "env"
okhin's avatar
okhin committed
8
9
10
11
12
13
14
15
16
17
    key: "$CI_PROJECT_ID"

stages:
    - test
    - build
    - deploy

unit tests:
    stage: test
    script:
okhin's avatar
okhin committed
18
        - virtualenv -p python3 env
okhin's avatar
okhin committed
19
20
21
22
23
24
        - source ./env/bin/activate
        - pip install -r requirements.txt
        - pip install -r requirements-dev.txt
        - pip install -r requirements-tests.txt
        - echo "DEBUG = True" > ./project/settings/env.py
        - echo "SECRET_KEY = '$(pwgen 20 1)'" >> ./project/settings/env.py
25
        - ./manage.py migrate
okhin's avatar
okhin committed
26
27
        - pytest apps/ --cov=apps/
    tags: [preprod]
28
29
30
31

static build:
    stage: test
    script:
32
        - virtualenv -p python3 env
33
34
        - source ./env/bin/activate
        - pip install -r requirements.txt
35
36
37
        - yarn install
        - webpack
        - echo "DEBUG = False" > ./project/settings/env.py
38
39
40
        - echo "SECRET_KEY = '$(pwgen 20 1)'" >> ./project/settings/env.py
        - ./manage.py collectstatic
    tags: [preprod]
41
42
43
44
    artifacts:
        paths:
            - static/
        expire_in: 1 day