選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

.drone.yml 2.4KB

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