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.

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