.drone.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ---
  2. ################
  3. # Build & Test #
  4. ################
  5. kind: pipeline
  6. name: build & deploy
  7. steps:
  8. # Run tests against Python/Flask engine backend (with pytest)
  9. - name: pytest with coverage
  10. image: python:3.11.1
  11. commands:
  12. # Install dependencies
  13. - cp vrobbler.conf.test vrobbler.conf
  14. - pip install poetry
  15. - poetry install --with test
  16. # Start with a fresh database (which is already running as a service from Drone)
  17. - poetry run pytest -n 5 --cov-report term:skip-covered --cov=vrobbler tests
  18. environment:
  19. VROBBLER_DATABASE_URL: sqlite:///test.db
  20. volumes:
  21. # Mount pip cache from host
  22. - name: pip_cache
  23. path: /root/.cache/pip
  24. - name: deploy
  25. image: appleboy/drone-ssh
  26. settings:
  27. host:
  28. - vrobbler.service
  29. username: root
  30. ssh_key:
  31. from_secret: jail_key
  32. command_timeout: 2m
  33. script:
  34. - pip uninstall -y vrobbler
  35. - pip install git+https://code.unbl.ink/secstate/vrobbler.git@main
  36. - vrobbler migrate
  37. - vrobbler collectstatic --noinput
  38. - immortalctl restart celery && immortalctl restart vrobbler
  39. when:
  40. branch:
  41. - main
  42. - name: build success notification
  43. image: parrazam/drone-ntfy:0.3-linux-amd64
  44. when:
  45. status: [success]
  46. settings:
  47. url: https://ntfy.unbl.ink
  48. topic: drone
  49. priority: low
  50. tags:
  51. - failure
  52. - vrobbler
  53. - name: build failure notification
  54. image: parrazam/drone-ntfy:0.3-linux-amd64
  55. when:
  56. status: [failure]
  57. settings:
  58. url: https://ntfy.unbl.ink
  59. topic: drone
  60. priority: high
  61. tags:
  62. - success
  63. - vrobbler
  64. volumes:
  65. - name: docker
  66. host:
  67. path: /var/run/docker.sock
  68. - name: pip_cache
  69. host:
  70. path: /tmp/cache/drone/pip