121 lines
2.4 KiB
YAML
121 lines
2.4 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: Tests
|
|
|
|
services:
|
|
- name: redis
|
|
image: redis
|
|
|
|
steps:
|
|
- name: test
|
|
image: python:3.11
|
|
environment:
|
|
REDIS_URL: redis://redis:6379/0
|
|
commands:
|
|
- pip install -r requirements.txt --cache-dir=/root/.cache/pip
|
|
- pip install coverage coveralls
|
|
- python manage.py collectstatic --noinput
|
|
- python manage.py migrate --noinput
|
|
- ./manage.py test
|
|
volumes:
|
|
- name: cache
|
|
path: /root/.cache/pip
|
|
trigger:
|
|
branch:
|
|
- master
|
|
|
|
volumes:
|
|
- name: cache
|
|
host:
|
|
path: /opt/docker/drone/cache
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: build
|
|
|
|
steps:
|
|
- name: build
|
|
image: docker
|
|
commands:
|
|
- docker build -t dntsk/later42:${DRONE_BRANCH} .
|
|
- docker tag dntsk/later42:${DRONE_BRANCH} dntsk/later42:latest
|
|
- docker push dntsk/later42:${DRONE_BRANCH}
|
|
volumes:
|
|
- name: cache
|
|
path: /root/.cache/pip
|
|
- name: docker_sock
|
|
path: /var/run/docker.sock
|
|
- name: docker_config
|
|
path: /root/.docker
|
|
|
|
volumes:
|
|
- name: cache
|
|
host:
|
|
path: /opt/docker/drone/cache
|
|
- name: docker_sock
|
|
host:
|
|
path: /var/run/docker.sock
|
|
- name: docker_config
|
|
host:
|
|
path: /root/.docker
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
|
|
depends_on:
|
|
- test
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: deploy
|
|
|
|
steps:
|
|
- name: deploy
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
from_secret: ssh_host
|
|
username:
|
|
from_secret: ssh_username
|
|
key:
|
|
from_secret: ssh_key
|
|
port: 22
|
|
script:
|
|
- cd /opt
|
|
- docker-compose pull later42
|
|
- docker-compose up -d later42 later42_tasks
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
|
|
depends_on:
|
|
- build
|
|
# ---
|
|
# kind: pipeline
|
|
# type: docker
|
|
# name: notifications
|
|
|
|
# steps:
|
|
# - name: telegram
|
|
# pull: always
|
|
# image: appleboy/drone-telegram
|
|
# settings:
|
|
# message: "{{#success build.status}} ✅ Build #{{build.number}} of `{{repo.name}}` succeeded.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n🌐 {{ build.link }} {{else}} ❌ Build #{{build.number}} of `{{repo.name}}` failed.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n🌐 {{ build.link }} {{/success}}\n"
|
|
# to:
|
|
# from_secret: telegram_to
|
|
# token:
|
|
# from_secret: telegram_token
|
|
|
|
# trigger:
|
|
# status:
|
|
# - success
|
|
# - failure
|
|
|
|
# depends_on:
|
|
# - deploy
|