.drone.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ---
  2. ################
  3. # Build & Test #
  4. ################
  5. kind: pipeline
  6. name: run_tests
  7. steps:
  8. # Run tests against Python/Flask engine backend (with pytest)
  9. - name: pytest with coverage
  10. image: python:3.10.4
  11. commands:
  12. # Install dependencies
  13. - cp vrobbler.conf.test vrobbler.conf
  14. - pip install poetry
  15. - poetry config repositories.unblink "https://pypi.unbl.ink/pypi/simple"
  16. - poetry install
  17. # Start with a fresh database (which is already running as a service from Drone)
  18. - poetry run pytest --cov-report term:skip-covered --cov=vrobbler tests
  19. environment:
  20. VROBBLER_DATABASE_URL: sqlite:///test.db
  21. volumes:
  22. # Mount pip cache from host
  23. - name: pip_cache
  24. path: /root/.cache/pip
  25. - name: deploy
  26. image: appleboy/drone-ssh
  27. settings:
  28. host:
  29. - vrobbler.service
  30. username: root
  31. ssh_key:
  32. from_secret: ssh_key
  33. command_timeout: 2m
  34. script:
  35. - pip uninstall -y vrobbler
  36. - pip install git+https://code.unbl.ink/secstate/vrobbler.git@main
  37. - vrobbler migrate
  38. - vrobbler collectstatic --noinput
  39. - immortalctl restart celery && immortalctl restart vrobbler
  40. when:
  41. branch:
  42. - main
  43. volumes:
  44. - name: docker
  45. host:
  46. path: /var/run/docker.sock
  47. - name: pip_cache
  48. host:
  49. path: /tmp/cache/drone/pip