.drone.yml 2.2 KB

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