You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.drone.yml 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. ---
  2. ################
  3. # SECRETS #
  4. ################
  5. # push_deploy_key: id_rsa from DRONE host machine
  6. ---
  7. #################
  8. # Frontend Test #
  9. ################
  10. kind: pipeline
  11. name: frontend_run_tests
  12. steps:
  13. # Test the vue frontend
  14. - name: test-frontend
  15. image: node
  16. commands:
  17. - pwd
  18. - cd ./frontend
  19. - npm install
  20. - npm test
  21. volumes:
  22. # Link node_modules cache from host filesystem into container at the expected location
  23. - name: frontend_node_cache
  24. path: /drone/src/frontend/node_modules
  25. volumes:
  26. - name: frontend_node_cache
  27. host:
  28. path: /tmp/cache/drone/frontend/node_modules
  29. - name: frontend_build
  30. host:
  31. path: /tmp/cache/drone/frontend/build
  32. ---
  33. ##################
  34. # Frontend Build #
  35. ##################
  36. kind: pipeline
  37. name: frontend_run_build
  38. trigger:
  39. status:
  40. # Only runs if the first pipeline was fully successful
  41. - success
  42. branch:
  43. - dev
  44. steps:
  45. - name: build-frontend
  46. image: node
  47. commands:
  48. - cd ./frontend
  49. - rm -Rf ./build/*
  50. - npx browserslist@latest --update-db
  51. - npm run build
  52. - ls ./build
  53. environment:
  54. NODE_OPTIONS: --openssl-legacy-provider
  55. volumes:
  56. # Link node_modules cache from host filesystem into container at the expected location
  57. - name: frontend_node_cache
  58. path: /drone/src/frontend/node_modules
  59. - name: frontend_build
  60. path: /drone/src/frontend/build
  61. volumes:
  62. - name: frontend_node_cache
  63. host:
  64. path: /tmp/cache/drone/frontend/node_modules
  65. - name: frontend_build
  66. host:
  67. path: /tmp/cache/drone/frontend/build
  68. ---
  69. #################
  70. # Backend Tests #
  71. #################
  72. kind: pipeline
  73. name: backend_run_tests
  74. steps:
  75. # Test the vue frontend
  76. - name: test-backend
  77. image: node
  78. commands:
  79. - pwd
  80. - cd ./backend
  81. - npm install
  82. - npm test
  83. volumes:
  84. # Link node_modules cache from host filesystem into container at the expected location
  85. - name: backend_node_cache
  86. path: /drone/src/backend/node_modules
  87. volumes:
  88. - name: backend_node_cache
  89. host:
  90. path: /tmp/cache/drone/backend/node_modules
  91. - name: backend_build
  92. host:
  93. path: /tmp/cache/drone/backend/build
  94. ---
  95. ########################
  96. # Deploy to Production #
  97. ########################
  98. kind: pipeline
  99. name: deploy
  100. depends_on:
  101. # Must run after the first pipeline
  102. - frontend_run_tests
  103. - backend_run_tests
  104. trigger:
  105. status:
  106. # Only runs if the first pipeline was fully successful
  107. - success
  108. branch:
  109. - master
  110. steps:
  111. # post-receive hook
  112. - name: push commit
  113. image: appleboy/drone-git-push:0.2.0-linux-amd64
  114. settings:
  115. branch: master
  116. remote: maeda@165.232.128.85:/opt/staging/siimee.git
  117. remote_name: staging
  118. force: true
  119. ssh_key:
  120. # !: id_rsa from DRONE machine
  121. from_secret: push_deploy_key
  122. volumes:
  123. - name: frontend_node_cache
  124. host:
  125. path: /tmp/cache/drone/frontend/node_modules
  126. - name: frontend_build
  127. host:
  128. path: /tmp/cache/drone/frontend/build
  129. - name: backend_node_cache
  130. host:
  131. path: /tmp/cache/drone/backend/node_modules