2019-12-06 10:55:00 +03:00
|
|
|
stages:
|
|
|
|
- lint
|
|
|
|
- test
|
|
|
|
|
|
|
|
variables:
|
|
|
|
POSTGRES_USER: '{{ cookiecutter.project_slug }}'
|
|
|
|
POSTGRES_PASSWORD: ''
|
|
|
|
POSTGRES_DB: 'test_{{ cookiecutter.project_slug }}'
|
2020-03-15 15:23:21 +03:00
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
2020-03-24 00:43:59 +03:00
|
|
|
{% if cookiecutter.use_celery == 'y' -%}
|
|
|
|
CELERY_BROKER_URL: 'redis://redis:6379/0'
|
|
|
|
{%- endif %}
|
2019-12-06 10:55:00 +03:00
|
|
|
|
|
|
|
flake8:
|
|
|
|
stage: lint
|
|
|
|
image: python:3.7-alpine
|
|
|
|
before_script:
|
|
|
|
- pip install -q flake8
|
|
|
|
script:
|
|
|
|
- flake8
|
|
|
|
|
|
|
|
pytest:
|
|
|
|
stage: test
|
|
|
|
image: python:3.7
|
2020-04-14 18:52:14 +03:00
|
|
|
{% if cookiecutter.use_docker == 'y' -%}
|
2020-05-30 00:23:15 +03:00
|
|
|
image: docker/compose:latest
|
2019-12-06 10:55:00 +03:00
|
|
|
tags:
|
|
|
|
- docker
|
2020-04-14 18:52:14 +03:00
|
|
|
services:
|
2020-05-30 01:05:44 +03:00
|
|
|
- docker:dind
|
2020-04-14 18:52:14 +03:00
|
|
|
before_script:
|
|
|
|
- docker-compose -f local.yml build
|
2020-04-16 20:34:12 +03:00
|
|
|
# Ensure celerybeat does not crash due to non-existent tables
|
|
|
|
- docker-compose -f local.yml run --rm django python manage.py migrate
|
2020-04-14 18:52:14 +03:00
|
|
|
- docker-compose -f local.yml up -d
|
|
|
|
script:
|
|
|
|
- docker-compose -f local.yml run django pytest
|
|
|
|
{%- else %}
|
|
|
|
tags:
|
|
|
|
- python
|
2019-12-06 10:55:00 +03:00
|
|
|
services:
|
|
|
|
- postgres:11
|
|
|
|
variables:
|
|
|
|
DATABASE_URL: pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- pip install -r requirements/local.txt
|
|
|
|
|
|
|
|
script:
|
|
|
|
- pytest
|
2020-04-14 18:52:14 +03:00
|
|
|
{%- endif %}
|
2019-12-06 10:55:00 +03:00
|
|
|
|