mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-23 01:57:03 +03:00
d2285d9e2d
* Removed celerybeat start's postgres_ready() for new PR for closer inspection and further review. Travis and GitLab CI reflect changes
52 lines
1.1 KiB
YAML
52 lines
1.1 KiB
YAML
stages:
|
|
- lint
|
|
- test
|
|
|
|
variables:
|
|
POSTGRES_USER: '{{ cookiecutter.project_slug }}'
|
|
POSTGRES_PASSWORD: ''
|
|
POSTGRES_DB: 'test_{{ cookiecutter.project_slug }}'
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
{% if cookiecutter.use_celery == 'y' -%}
|
|
CELERY_BROKER_URL: 'redis://redis:6379/0'
|
|
{%- endif %}
|
|
|
|
flake8:
|
|
stage: lint
|
|
image: python:3.7-alpine
|
|
before_script:
|
|
- pip install -q flake8
|
|
script:
|
|
- flake8
|
|
|
|
pytest:
|
|
stage: test
|
|
image: python:3.7
|
|
{% if cookiecutter.use_docker == 'y' -%}
|
|
tags:
|
|
- docker
|
|
services:
|
|
- docker
|
|
before_script:
|
|
- docker-compose -f local.yml build
|
|
# Ensure celerybeat does not crash due to non-existent tables
|
|
- docker-compose -f local.yml run --rm django python manage.py migrate
|
|
- docker-compose -f local.yml up -d
|
|
script:
|
|
- docker-compose -f local.yml run django pytest
|
|
{%- else %}
|
|
tags:
|
|
- python
|
|
services:
|
|
- postgres:11
|
|
variables:
|
|
DATABASE_URL: pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB
|
|
|
|
before_script:
|
|
- pip install -r requirements/local.txt
|
|
|
|
script:
|
|
- pytest
|
|
{%- endif %}
|
|
|