Files
Touchh/.drone.yml
2024-12-28 11:59:51 +09:00

93 lines
2.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

kind: pipeline
name: Touchh Hotel AntiFraud Pipeline
namespace: touchh
steps:
# Шаг 1: Клонирование репозитория
- name: clone_repo
image: alpine/git
commands:
- if [ ! -d .git ]; then git clone $DRONE_REPO_URL .; fi
- git fetch --all
- git reset --hard $DRONE_COMMIT
# Шаг 2: Обновление и запуск с помощью update.sh
- name: deploy_app
image: python:3.12
environment:
MYSQL_PASSWORD: touchh
commands:
- chmod +x ./bin/update
- ./bin/update
# Шаг 3: Миграция базы данных
- name: run_migrations
image: python:3.12
environment:
MYSQL_PASSWORD: touchh
commands:
- chmod +x ./bin/cli
- ./bin/cli migrate
# Шаг 4: Тестирование
- name: run_tests
image: python:3.12-alpine
environment:
MYSQL_PASSWORD: touchh
commands:
- apk add --no-cache mariadb-client
- pip install -r requirements.txt
- python manage.py test
services:
# Сервис базы данных
- name: db
image: mariadb:11.6
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 1
MYSQL_DATABASE: touchh
MYSQL_USER: touchh
MYSQL_PASSWORD: touchh
volumes:
- name: mysql_data
path: /var/lib/mysql
# Сервис Django (Web)
- name: web
image: touchh-py
environment:
MYSQL_PASSWORD: touchh
command: ['python3', 'manage.py', 'runserver', '0.0.0.0:8000']
ports:
- "8000:8000"
depends_on:
- db
# Сервис Telegram Bot
- name: bot
image: touchh-py
environment:
MYSQL_PASSWORD: touchh
command: ['python3', 'manage.py', 'run_bot']
depends_on:
- db
# Сервис планировщика задач
- name: scheduler
image: touchh-py
environment:
MYSQL_PASSWORD: touchh
command: ['python3', 'manage.py', 'start_scheduler']
depends_on:
- db
volumes:
- name: mysql_data
host:
path: ./var/mysql
trigger:
event:
- push
- pull_request