ci.yml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. name: Node CI for growi
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - rc/**
  7. - chore/**
  8. - support/prepare-v**
  9. jobs:
  10. lint:
  11. runs-on: ubuntu-latest
  12. strategy:
  13. matrix:
  14. node-version: [14.x]
  15. steps:
  16. - uses: actions/checkout@v2
  17. - uses: actions/setup-node@v2
  18. with:
  19. node-version: ${{ matrix.node-version }}
  20. cache: 'yarn'
  21. cache-dependency-path: '**/yarn.lock'
  22. - name: lerna bootstrap
  23. run: |
  24. npx lerna bootstrap
  25. - name: Print dependencies
  26. run: |
  27. echo -n "node " && node -v
  28. echo -n "npm " && npm -v
  29. yarn list --depth=0
  30. - name: lerna run lint for plugins
  31. run: |
  32. yarn lerna run lint --scope @growi/plugin-*
  33. - name: lerna run lint for app
  34. run: |
  35. yarn lerna run lint --scope @growi/app --scope @growi/core --scope @growi/ui
  36. - name: Slack Notification
  37. uses: weseek/ghaction-slack-notification@master
  38. if: failure()
  39. with:
  40. type: ${{ job.status }}
  41. job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  42. channel: '#ci'
  43. isCompactMode: true
  44. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  45. test:
  46. runs-on: ubuntu-latest
  47. strategy:
  48. matrix:
  49. node-version: [14.x]
  50. services:
  51. mongodb:
  52. image: mongo:4.4
  53. ports:
  54. - 27017/tcp
  55. mongodb36:
  56. image: mongo:3.6
  57. ports:
  58. - 27017/tcp
  59. steps:
  60. - uses: actions/checkout@v2
  61. - uses: actions/setup-node@v2
  62. with:
  63. node-version: ${{ matrix.node-version }}
  64. cache: 'yarn'
  65. cache-dependency-path: '**/yarn.lock'
  66. - name: lerna bootstrap
  67. run: |
  68. npx lerna bootstrap
  69. - name: Print dependencies
  70. run: |
  71. echo -n "node " && node -v
  72. echo -n "npm " && npm -v
  73. yarn list --depth=0
  74. - name: yarn test
  75. working-directory: ./packages/app
  76. run: |
  77. yarn test
  78. env:
  79. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  80. - name: yarn test with MongoDB 3.6
  81. working-directory: ./packages/app
  82. run: |
  83. yarn test
  84. env:
  85. MONGO_URI: mongodb://localhost:${{ job.services.mongodb36.ports['27017'] }}/growi_test
  86. - name: Upload coverage report as artifact
  87. uses: actions/upload-artifact@v2
  88. with:
  89. name: Coverage Report
  90. path: packages/app/coverage
  91. - name: Slack Notification
  92. uses: weseek/ghaction-slack-notification@master
  93. if: failure()
  94. with:
  95. type: ${{ job.status }}
  96. job_name: '*Node CI for growi - test (${{ matrix.node-version }})*'
  97. channel: '#ci'
  98. isCompactMode: true
  99. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  100. launch-dev:
  101. runs-on: ubuntu-latest
  102. strategy:
  103. matrix:
  104. node-version: [14.x]
  105. services:
  106. mongodb:
  107. image: mongo:4.4
  108. ports:
  109. - 27017/tcp
  110. steps:
  111. - uses: actions/checkout@v2
  112. - uses: actions/setup-node@v2
  113. with:
  114. node-version: ${{ matrix.node-version }}
  115. cache: 'yarn'
  116. cache-dependency-path: '**/yarn.lock'
  117. - name: lerna bootstrap
  118. run: |
  119. npx lerna bootstrap
  120. - name: Print dependencies
  121. run: |
  122. echo -n "node " && node -v
  123. echo -n "npm " && npm -v
  124. yarn list --depth=0
  125. - name: yarn dev:ci
  126. working-directory: ./packages/app
  127. run: |
  128. cp config/ci/.env.local.for-ci .env.development.local
  129. yarn dev:ci
  130. env:
  131. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  132. - name: Slack Notification
  133. uses: weseek/ghaction-slack-notification@master
  134. if: failure()
  135. with:
  136. type: ${{ job.status }}
  137. job_name: '*Node CI for growi - build-dev (${{ matrix.node-version }})*'
  138. channel: '#ci'
  139. isCompactMode: true
  140. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  141. launch-prod:
  142. runs-on: ubuntu-latest
  143. strategy:
  144. matrix:
  145. node-version: [12.x, 14.x]
  146. services:
  147. mongodb:
  148. image: mongo:4.4
  149. ports:
  150. - 27017/tcp
  151. mongodb36:
  152. image: mongo:3.6
  153. ports:
  154. - 27017/tcp
  155. steps:
  156. - uses: actions/checkout@v2
  157. - uses: actions/setup-node@v2
  158. with:
  159. node-version: ${{ matrix.node-version }}
  160. cache: 'yarn'
  161. cache-dependency-path: '**/yarn.lock'
  162. - name: Remove unnecessary packages
  163. run: |
  164. rm -rf packages/slackbot-proxy
  165. - name: lerna bootstrap
  166. run: |
  167. npx lerna bootstrap
  168. - name: Print dependencies
  169. run: |
  170. echo -n "node " && node -v
  171. echo -n "npm " && npm -v
  172. yarn list --depth=0
  173. - name: Build
  174. run: |
  175. yarn lerna run build
  176. env:
  177. ANALYZE_BUNDLE_SIZE: ${{ matrix.node-version == '14.x' }}
  178. - name: lerna bootstrap --production
  179. run: |
  180. npx lerna bootstrap -- --production
  181. - name: Print dependencies
  182. run: |
  183. echo -n "node " && node -v
  184. echo -n "npm " && npm -v
  185. yarn list --production --depth=0
  186. - name: Get DB name
  187. id: getdbname
  188. run: |
  189. echo ::set-output name=suffix::$(echo '${{ matrix.node-version }}' | sed s/\\.//)
  190. - name: yarn server:ci
  191. working-directory: ./packages/app
  192. run: |
  193. cp config/ci/.env.local.for-ci .env.production.local
  194. yarn server:ci
  195. env:
  196. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi-${{ steps.getdbname.outputs.suffix }}
  197. - name: yarn server:ci with MongoDB 3.6
  198. working-directory: ./packages/app
  199. run: |
  200. cp config/ci/.env.local.for-ci .env.production.local
  201. yarn server:ci
  202. env:
  203. MONGO_URI: mongodb://localhost:${{ job.services.mongodb36.ports['27017'] }}/growi-${{ steps.getdbname.outputs.suffix }}
  204. - name: Upload report as artifact
  205. uses: actions/upload-artifact@v2
  206. with:
  207. name: Bundle Analyzing Report
  208. path: packages/app/report/bundle-analyzer.html
  209. - name: Slack Notification
  210. uses: weseek/ghaction-slack-notification@master
  211. if: failure()
  212. with:
  213. type: ${{ job.status }}
  214. job_name: '*Node CI for growi - build-prod (${{ matrix.node-version }})*'
  215. channel: '#ci'
  216. isCompactMode: true
  217. url: ${{ secrets.SLACK_WEBHOOK_URL }}