.drone.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 install
  16. # Start with a fresh database (which is already running as a service from Drone)
  17. - poetry run pytest --cov-report term:skip-covered --cov=emus tests
  18. environment:
  19. EMUS_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. - emus.service
  29. username: root
  30. ssh_key:
  31. from_secret: jail_key
  32. command_timeout: 2m
  33. script:
  34. - pip uninstall -y emus-web
  35. - pip install git+https://code.unbl.ink/secstate/emus.git@main
  36. - emus migrate
  37. - emus collectstatic --noinput
  38. - immortalctl restart emus
  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. - cd
  52. - failure
  53. - emus
  54. - name: build failure notification
  55. image: parrazam/drone-ntfy:0.3-linux-amd64
  56. when:
  57. status: [failure]
  58. settings:
  59. url: https://ntfy.unbl.ink
  60. topic: drone
  61. priority: high
  62. tags:
  63. - cd
  64. - success
  65. - emus
  66. volumes:
  67. - name: docker
  68. host:
  69. path: /var/run/docker.sock
  70. - name: pip_cache
  71. host:
  72. path: /tmp/cache/drone/pip