52 lines
1.4 KiB
YAML
52 lines
1.4 KiB
YAML
---
|
|
################
|
|
# Build & Test #
|
|
################
|
|
|
|
kind: pipeline
|
|
name: run_tests
|
|
|
|
steps:
|
|
# Run tests against Python/Flask engine backend (with pytest)
|
|
- name: pytest with coverage
|
|
image: python:3.10.4
|
|
commands:
|
|
# Install dependencies
|
|
- cp vrobbler.conf.test vrobbler.conf
|
|
- pip install poetry
|
|
- poetry config repositories.unblink "https://pypi.unbl.ink/pypi/simple"
|
|
- poetry install
|
|
# Start with a fresh database (which is already running as a service from Drone)
|
|
- poetry run pytest --cov-report term:skip-covered --cov=vrobbler tests
|
|
environment:
|
|
VROBBLER_DATABASE_URL: sqlite:///test.db
|
|
volumes:
|
|
# Mount pip cache from host
|
|
- name: pip_cache
|
|
path: /root/.cache/pip
|
|
- name: deploy
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
- vrobbler.service
|
|
username: root
|
|
ssh_key:
|
|
from_secret: ssh_key
|
|
command_timeout: 2m
|
|
script:
|
|
- pip uninstall -y vrobbler
|
|
- pip install git+https://code.unbl.ink/secstate/vrobbler.git@main
|
|
- vrobbler migrate
|
|
- vrobbler collectstatic --noinput
|
|
- immortalctl restart celery && immortalctl restart vrobbler
|
|
when:
|
|
branch:
|
|
- main
|
|
volumes:
|
|
- name: docker
|
|
host:
|
|
path: /var/run/docker.sock
|
|
- name: pip_cache
|
|
host:
|
|
path: /tmp/cache/drone/pip
|