stages: - build - lint - test - deploy cache: paths: - .cache/ variables: PIPENV_CACHE_DIR: "$CI_PROJECT_DIR/.cache" build base image: image: docker:stable-git stage: build script: - sh scripts/deploy-ci.sh tags: - docker only: - master - django lint: image: registry.gitlab.com/python-discord/projects/site/django-base:latest stage: lint script: - pipenv install --dev --system - flake8 test: image: registry.gitlab.com/python-discord/projects/site/django-base:latest stage: test services: - postgres:10-alpine before_script: - python manage.py migrate - pip install coverage script: - coverage run --source=api,home,pysite,wiki --branch manage.py test after_script: - coverage report artifacts: paths: - .coverage variables: DATABASE_URL: postgres://django:supersecret@postgres/pysite POSTGRES_DB: pysite POSTGRES_PASSWORD: supersecret POSTGRES_USER: django pages: stage: deploy image: dependencies: - test before_script: - pip install coverage script: - coverage html --directory=public artifacts: paths: - public expire_in: 30 days