later42/.drone.yml
2022-11-16 10:29:36 +03:00

126 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 dntskdev/later42:${DRONE_BRANCH} .
- docker tag dntskdev/later42:${DRONE_BRANCH} dntskdev/later42:latest
- docker push dntskdev/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:
- Tests
---
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
event:
include:
- push
depends_on:
- Build
---
kind: pipeline
type: docker
name: Notify
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