.drone.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ---
  2. ################
  3. # Build & Test #
  4. ################
  5. kind: pipeline
  6. name: run_tests
  7. steps:
  8. - name: pytest with coverage
  9. image: python:3.11.1
  10. commands:
  11. # Install dependencies
  12. - cp emus.conf.example emus.conf
  13. - pip install poetry
  14. - poetry install
  15. # Start with a fresh database (which is already running as a service from Drone)
  16. - poetry run python manage.py test
  17. environment:
  18. EMUS_DATABASE_URL: sqlite:///test.db
  19. volumes:
  20. # Mount pip cache from host
  21. - name: pip_cache
  22. path: /root/.cache/pip
  23. - name: deploy
  24. image: appleboy/drone-ssh
  25. settings:
  26. host:
  27. - emus.service
  28. username: root
  29. ssh_key:
  30. from_secret: ssh_key
  31. command_timeout: 2m
  32. script:
  33. - pip uninstall -y emus-web
  34. - pip install git+https://code.unbl.ink/secstate/emus.git@main
  35. - emus migrate
  36. - emus collectstatic --noinput
  37. - immortalctl restart emus
  38. when:
  39. branch:
  40. - main
  41. volumes:
  42. - name: docker
  43. host:
  44. path: /var/run/docker.sock
  45. - name: pip_cache
  46. host:
  47. path: /tmp/cache/drone/pip