mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-30 21:44:06 +03:00
50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
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' %}
|
|
REDIS_URL: 'redis://redis:6379/0'
|
|
{%- endif %}
|
|
|
|
steps:
|
|
- name: lint
|
|
pull: if-not-exists
|
|
image: python:3.12
|
|
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' %}
|
|
image: docker:25.0
|
|
environment:
|
|
DATABASE_URL: pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB
|
|
commands:
|
|
- 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
|
|
{%- else %}
|
|
image: python:3.12
|
|
commands:
|
|
- pip install -r requirements/local.txt
|
|
- pytest
|
|
{%- endif%}
|
|
|
|
volumes:
|
|
- name: pre-commit cache
|
|
host:
|
|
path: /tmp/drone/cache/pre-commit
|