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

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