.drone.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.11.1
  11. commands:
  12. # Install dependencies
  13. - cp emus.conf.example emus.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=emus tests
  19. environment:
  20. EMUS_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. - emus.service
  30. username: root
  31. ssh_key:
  32. from_secret: ssh_key
  33. command_timeout: 2m
  34. script:
  35. - pip uninstall -y emus-web
  36. - pip install git+https://code.unbl.ink/secstate/emus.git@main
  37. - emus migrate
  38. - emus collectstatic --noinput
  39. - immortalctl restart emus
  40. when:
  41. branch:
  42. - main
  43. - name: build success notification
  44. image: parrazam/drone-ntfy
  45. when:
  46. status: [success]
  47. settings:
  48. url: https://ntfy.unbl.ink
  49. topic: drone
  50. priority: low
  51. tags:
  52. - cd
  53. - failure
  54. - vrobbler
  55. - name: build failure notification
  56. image: parrazam/drone-ntfy
  57. when:
  58. status: [failure]
  59. settings:
  60. url: https://ntfy.unbl.ink
  61. topic: drone
  62. priority: high
  63. tags:
  64. - cd
  65. - success
  66. - vrobbler
  67. volumes:
  68. - name: docker
  69. host:
  70. path: /var/run/docker.sock
  71. - name: pip_cache
  72. host:
  73. path: /tmp/cache/drone/pip