.drone.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. - pip install poetry
  14. - poetry install --with test
  15. # Start with a fresh database (which is already running as a service from Drone)
  16. - poetry run pytest -n 5 --cov-report term:skip-covered --cov=coffee_wars tests
  17. volumes:
  18. # Mount pip cache from host
  19. - name: pip_cache
  20. path: /root/.cache/pip
  21. - name: deploy
  22. image: appleboy/drone-ssh
  23. settings:
  24. host:
  25. - coffeewars.service
  26. username: root
  27. ssh_key:
  28. from_secret: jail_key
  29. command_timeout: 2m
  30. script:
  31. - pip uninstall -y coffee_wars
  32. - pip install git+https://code.unbl.ink/secstate/coffee_wars.git@main
  33. - cw migrate
  34. - cw collectstatic --noinput
  35. - immortalctl restart celery && immortalctl restart coffee_wars
  36. when:
  37. ref:
  38. - refs/tags/*
  39. - name: build success notification
  40. image: parrazam/drone-ntfy:0.3-linux-amd64
  41. when:
  42. status: [success]
  43. settings:
  44. url: https://ntfy.unbl.ink
  45. topic: drone
  46. priority: low
  47. tags:
  48. - failure
  49. - coffee_wars
  50. - name: build failure notification
  51. image: parrazam/drone-ntfy:0.3-linux-amd64
  52. when:
  53. status: [failure]
  54. settings:
  55. url: https://ntfy.unbl.ink
  56. topic: drone
  57. priority: high
  58. tags:
  59. - success
  60. - coffee_wars
  61. volumes:
  62. - name: docker
  63. host:
  64. path: /var/run/docker.sock
  65. - name: pip_cache
  66. host:
  67. path: /tmp/cache/drone/pip