2023-07-28 15:03:47 +03:00
|
|
|
kind: pipeline
|
|
|
|
name: default
|
|
|
|
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: '{{ cookiecutter.project_slug }}'
|
|
|
|
POSTGRES_PASSWORD: ''
|
|
|
|
POSTGRES_DB: 'test_{{ cookiecutter.project_slug }}'
|
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
|
|
{%- if cookiecutter.use_celery == 'y' %}
|
2024-02-15 12:30:46 +03:00
|
|
|
REDIS_URL: 'redis://redis:6379/0'
|
2023-07-28 15:03:47 +03:00
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: lint
|
|
|
|
pull: if-not-exists
|
2024-03-18 21:55:00 +03:00
|
|
|
image: python:3.12
|
2023-07-28 15:03:47 +03:00
|
|
|
environment:
|
|
|
|
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
|
|
|
|
volumes:
|
|
|
|
- name: pre-commit cache
|
|
|
|
path: ${PRE_COMMIT_HOME}
|
|
|
|
commands:
|
|
|
|
- export PRE_COMMIT_HOME=$CI_PROJECT_DIR/.cache/pre-commit
|
|
|
|
- pip install -q pre-commit
|
|
|
|
- pre-commit run --show-diff-on-failure --color=always --all-files
|
|
|
|
|
|
|
|
- name: test
|
|
|
|
pull: if-not-exists
|
|
|
|
{%- if cookiecutter.use_docker == 'y' %}
|
2024-04-02 18:22:33 +03:00
|
|
|
image: docker:25.0
|
2023-07-28 15:03:47 +03:00
|
|
|
environment:
|
|
|
|
DATABASE_URL: pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB
|
|
|
|
commands:
|
2024-05-13 20:18:56 +03:00
|
|
|
- docker-compose -f docker-compose.local.yml build
|
|
|
|
- docker-compose -f docker-compose.docs.yml build
|
|
|
|
- docker-compose -f docker-compose.local.yml run --rm django python manage.py migrate
|
|
|
|
- docker-compose -f docker-compose.local.yml up -d
|
|
|
|
- docker-compose -f docker-compose.local.yml run django pytest
|
2023-07-28 15:03:47 +03:00
|
|
|
{%- else %}
|
2024-03-18 21:55:00 +03:00
|
|
|
image: python:3.12
|
2023-07-28 15:03:47 +03:00
|
|
|
commands:
|
|
|
|
- pip install -r requirements/local.txt
|
|
|
|
- pytest
|
|
|
|
{%- endif%}
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: pre-commit cache
|
|
|
|
host:
|
|
|
|
path: /tmp/drone/cache/pre-commit
|