.gitlab-ci.yml 1.34 KB
Newer Older
1
variables:
2
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
3

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

stages:
    - test
    - deploy

before_script:
    - pip install --user tox
    - export PATH="$HOME/.local/bin:$PATH"

17
unit tests:
18
    stage: test
19
    script: tox -e py27
20
    tags: [memopol]
21

22
qa checks:
23 24 25 26
    stage: test
    script: tox -e qa
    tags: [memopol]

27
docs build:
28
    stage: test
29
    script: git diff --raw HEAD^1 | grep docs || tox -e docs
30 31
    tags: [memopol]

32 33
docs deploy:
    stage: deploy
34 35 36 37
    script:
        - source /srv/memopol/memopol_env/bin/activate
        - cd /srv/memopol/memopol_env/src/memopol/docs
        - make html
38 39 40 41 42 43 44 45 46
    tags: [memopol]
    environment: production
    only:
        - master

django deploy:
    stage: deploy
    script:
        - source /srv/memopol/memopol_env/bin/activate
47 48 49 50
        - cd /srv/memopol/memopol_env/src/memopol
        - git fetch origin
        - git reset --hard origin/master
        - find . -name '*.pyc' -delete
njoyard's avatar
njoyard committed
51
        - find . -name '__pycache__' | xargs rm -rf
52
        - rm -r src/*.egg-info
53 54 55 56 57 58 59 60 61
        - pip install -Ue .
        - src/memopol/bin/install_client_deps.sh
        - memopol migrate --noinput
        - memopol collectstatic --noinput
        - touch /srv/memopol/ready
    tags: [memopol]
    environment: production
    only:
        - master