.drone.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. kind: pipeline
  2. type: docker
  3. name: default
  4. steps:
  5. - name: unit-test
  6. image: python:3.9.9-slim
  7. commands:
  8. - pip install poetry
  9. - poetry install
  10. - poetry run pytest ./tests/
  11. volumes:
  12. - name: cache-pip
  13. path: /root/.cache/pip
  14. - name: cache-poetry
  15. path: /root/.cache/pypoetry
  16. - name: build-only
  17. image: plugins/docker
  18. settings:
  19. repo: drone-ci/${DRONE_REPO_NAMESPACE,,}/${DRONE_REPO_NAME,,}
  20. dry_run: true
  21. volumes:
  22. - name: docker_sock
  23. path: /var/run/docker.sock
  24. when:
  25. ref:
  26. exclude:
  27. - refs/tags/*
  28. - name: build-and-push
  29. image: plugins/docker
  30. settings:
  31. username:
  32. from_secret: NUCNAS_DOCKER_USERNAME
  33. password:
  34. from_secret: NUCNAS_DOCKER_PASSWORD
  35. repo: docker.snas.black-burn.ch/${DRONE_REPO_NAMESPACE,,}/${DRONE_REPO_NAME,,}
  36. registry: docker.snas.black-burn.ch
  37. volumes:
  38. - name: docker_sock
  39. path: /var/run/docker.sock
  40. when:
  41. ref:
  42. - refs/tags/*
  43. - name: discord notification
  44. image: appleboy/drone-discord
  45. when:
  46. status:
  47. - failure
  48. - success
  49. settings:
  50. username: drone-ci
  51. webhook_id:
  52. from_secret: DISCORD_WEBHOOK_ID
  53. webhook_token:
  54. from_secret: DISCORD_WEBHOOK_TOKEN
  55. message: >
  56. {{#success build.status}}
  57. :green_square: {{repo.name}} #{{build.number}}
  58. {{commit.branch}} / {{truncate commit.sha 8}} / {{commit.author}}
  59. Build succeeded!
  60. {{else}}
  61. :red_square: {{repo.name}} #{{build.number}}
  62. {{commit.branch}} / {{truncate commit.sha 8}} / {{commit.author}}
  63. Build failed!
  64. {{/success}}
  65. volumes:
  66. - name: docker_sock
  67. host:
  68. path: /var/run/docker.sock
  69. - name: cache-pip
  70. host:
  71. path: /tmp/drone/cache/pip
  72. - name: cache-poetry
  73. host:
  74. path: /tmp/drone/cache/poetry