diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 01325ea..943cf0d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,10 @@ services: - mdillon/postgis:9.6-alpine variables: + # Change pip's cache directory to be inside the project directory since we can + # only cache local items. + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + DEBUG: 1 POSTGRES_DB: ojusomap @@ -20,14 +24,24 @@ variables: DATABASE_USER: $POSTGRES_USER DATABASE_PASSWORD: $POSTGRES_PASSWORD +# This folder is cached between builds +# http://docs.gitlab.com/ce/ci/yaml/README.html#cache +cache: + paths: + - .cache/pip + +before_script: + - apt-get update && cat system-requirements-debian.txt | xargs apt-get install -y + - python manage.py collectstatic + - python -V + - pip install virtualenv + - virtualenv venv + - source venv/bin/activate + - pip install -U pip setuptools + - pip install -r requirements/base.txt + - pip install -r requirements/test.txt pytest: stage: test - before_script: - - pip install -U pip setuptools - - pip install -r requirements/base.txt - - pip install -r requirements/test.txt - - apt-get update && cat system-requirements-debian.txt | xargs apt-get install -y - - python manage.py collectstatic script: - pytest -v --cov=ojusomap --cov=apps