ci.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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. install-node14:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v2
  14. - uses: actions/setup-node@v2
  15. with:
  16. node-version: 14.x
  17. cache: 'yarn'
  18. cache-dependency-path: '**/yarn.lock'
  19. - name: Cache/Restore node_modules
  20. id: cache-dependencies
  21. uses: actions/cache@v2
  22. with:
  23. path: |
  24. **/node_modules
  25. key: ${{ runner.OS }}-node_modules-14.x-${{ hashFiles('**/yarn.lock') }}
  26. restore-keys: |
  27. ${{ runner.os }}-node_modules-14.x-
  28. - name: lerna bootstrap
  29. run: |
  30. npx lerna bootstrap
  31. - name: Print dependencies
  32. run: |
  33. echo -n "node " && node -v
  34. echo -n "npm " && npm -v
  35. yarn list --depth=0
  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 - install-node14*'
  42. channel: '#ci'
  43. isCompactMode: true
  44. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  45. lint:
  46. needs: install-node14
  47. runs-on: ubuntu-latest
  48. steps:
  49. - uses: actions/checkout@v2
  50. - uses: actions/setup-node@v2
  51. with:
  52. node-version: 14.x
  53. cache: 'yarn'
  54. cache-dependency-path: '**/yarn.lock'
  55. - name: Cache/Restore node_modules
  56. id: cache-dependencies
  57. uses: actions/cache@v2
  58. with:
  59. path: |
  60. **/node_modules
  61. key: ${{ runner.OS }}-node_modules-14.x-${{ hashFiles('**/yarn.lock') }}
  62. restore-keys: |
  63. ${{ runner.os }}-node_modules-14.x-
  64. - name: lerna bootstrap
  65. run: |
  66. npx lerna bootstrap
  67. - name: lerna run lint for plugins
  68. run: |
  69. yarn lerna run lint --scope @growi/plugin-*
  70. - name: lerna run lint for app
  71. run: |
  72. yarn lerna run lint --scope @growi/app --scope @growi/core --scope @growi/ui
  73. - name: Slack Notification
  74. uses: weseek/ghaction-slack-notification@master
  75. if: failure()
  76. with:
  77. type: ${{ job.status }}
  78. job_name: '*Node CI for growi - lint (14.x)*'
  79. channel: '#ci'
  80. isCompactMode: true
  81. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  82. test:
  83. needs: install-node14
  84. runs-on: ubuntu-latest
  85. services:
  86. mongodb:
  87. image: mongo:4.4
  88. ports:
  89. - 27017/tcp
  90. mongodb36:
  91. image: mongo:3.6
  92. ports:
  93. - 27017/tcp
  94. steps:
  95. - uses: actions/checkout@v2
  96. - uses: actions/setup-node@v2
  97. with:
  98. node-version: 14.x
  99. cache: 'yarn'
  100. cache-dependency-path: '**/yarn.lock'
  101. - name: Cache/Restore node_modules
  102. id: cache-dependencies
  103. uses: actions/cache@v2
  104. with:
  105. path: |
  106. **/node_modules
  107. key: ${{ runner.OS }}-node_modules-14.x-${{ hashFiles('**/yarn.lock') }}
  108. restore-keys: |
  109. ${{ runner.os }}-node_modules-14.x-
  110. - name: lerna bootstrap
  111. run: |
  112. npx lerna bootstrap
  113. - name: yarn test
  114. working-directory: ./packages/app
  115. run: |
  116. yarn test
  117. env:
  118. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  119. - name: yarn test with MongoDB 3.6
  120. working-directory: ./packages/app
  121. run: |
  122. yarn test
  123. env:
  124. MONGO_URI: mongodb://localhost:${{ job.services.mongodb36.ports['27017'] }}/growi_test
  125. - name: Upload coverage report as artifact
  126. uses: actions/upload-artifact@v2
  127. with:
  128. name: Coverage Report
  129. path: packages/app/coverage
  130. - name: Slack Notification
  131. uses: weseek/ghaction-slack-notification@master
  132. if: failure()
  133. with:
  134. type: ${{ job.status }}
  135. job_name: '*Node CI for growi - test (14.x)*'
  136. channel: '#ci'
  137. isCompactMode: true
  138. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  139. launch-dev:
  140. needs: install-node14
  141. runs-on: ubuntu-latest
  142. services:
  143. mongodb:
  144. image: mongo:4.4
  145. ports:
  146. - 27017/tcp
  147. steps:
  148. - uses: actions/checkout@v2
  149. - uses: actions/setup-node@v2
  150. with:
  151. node-version: 14.x
  152. cache: 'yarn'
  153. cache-dependency-path: '**/yarn.lock'
  154. - name: Cache/Restore node_modules
  155. id: cache-dependencies
  156. uses: actions/cache@v2
  157. with:
  158. path: |
  159. **/node_modules
  160. key: ${{ runner.OS }}-node_modules-14.x-${{ hashFiles('**/yarn.lock') }}
  161. restore-keys: |
  162. ${{ runner.os }}-node_modules-14.x-
  163. - name: lerna bootstrap
  164. run: |
  165. npx lerna bootstrap
  166. - name: yarn dev:ci
  167. working-directory: ./packages/app
  168. run: |
  169. cp config/ci/.env.local.for-ci .env.development.local
  170. yarn dev:ci
  171. env:
  172. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  173. - name: Slack Notification
  174. uses: weseek/ghaction-slack-notification@master
  175. if: failure()
  176. with:
  177. type: ${{ job.status }}
  178. job_name: '*Node CI for growi - launch-dev (14.x)*'
  179. channel: '#ci'
  180. isCompactMode: true
  181. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  182. build-prod:
  183. needs: install-node14
  184. runs-on: ubuntu-latest
  185. steps:
  186. - uses: actions/checkout@v2
  187. - uses: actions/setup-node@v2
  188. with:
  189. node-version: 14.x
  190. cache: 'yarn'
  191. cache-dependency-path: '**/yarn.lock'
  192. - name: Cache/Restore node_modules
  193. id: cache-dependencies
  194. uses: actions/cache@v2
  195. with:
  196. path: |
  197. **/node_modules
  198. key: ${{ runner.OS }}-node_modules-14.x-${{ hashFiles('**/yarn.lock') }}
  199. restore-keys: |
  200. ${{ runner.os }}-node_modules-14.x-
  201. - name: Remove unnecessary packages
  202. run: |
  203. rm -rf packages/slackbot-proxy
  204. - name: lerna bootstrap
  205. run: |
  206. npx lerna bootstrap
  207. - name: Build
  208. run: |
  209. yarn lerna run build
  210. env:
  211. ANALYZE_BUNDLE_SIZE: 1
  212. - name: Upload built artifact
  213. uses: actions/upload-artifact@v2
  214. with:
  215. name: Built Files
  216. path: packages/**/dist
  217. - name: Upload report as artifact
  218. uses: actions/upload-artifact@v2
  219. with:
  220. name: Bundle Analyzing Report
  221. path: packages/app/report/bundle-analyzer.html
  222. - name: Slack Notification
  223. uses: weseek/ghaction-slack-notification@master
  224. if: failure()
  225. with:
  226. type: ${{ job.status }}
  227. job_name: '*Node CI for growi - build-prod (14.x)*'
  228. channel: '#ci'
  229. isCompactMode: true
  230. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  231. launch-prod:
  232. needs: build-prod
  233. runs-on: ubuntu-latest
  234. services:
  235. mongodb:
  236. image: mongo:4.4
  237. ports:
  238. - 27017/tcp
  239. mongodb36:
  240. image: mongo:3.6
  241. ports:
  242. - 27017/tcp
  243. steps:
  244. - uses: actions/checkout@v2
  245. - uses: actions/setup-node@v2
  246. with:
  247. node-version: 14.x
  248. cache: 'yarn'
  249. cache-dependency-path: '**/yarn.lock'
  250. - name: Cache/Restore node_modules
  251. id: cache-dependencies
  252. uses: actions/cache@v2
  253. with:
  254. path: |
  255. **/node_modules
  256. key: ${{ runner.OS }}-node_modules-14.x-${{ hashFiles('**/yarn.lock') }}
  257. restore-keys: |
  258. ${{ runner.os }}-node_modules-14.x-
  259. - name: Remove unnecessary packages
  260. run: |
  261. rm -rf packages/slackbot-proxy
  262. - name: lerna bootstrap --production
  263. run: |
  264. npx lerna bootstrap -- --production
  265. - name: Download built artifact
  266. uses: actions/download-artifact@v2
  267. with:
  268. name: Built Files
  269. - name: yarn server:ci
  270. working-directory: ./packages/app
  271. run: |
  272. cp config/ci/.env.local.for-ci .env.production.local
  273. yarn server:ci
  274. env:
  275. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi
  276. - name: yarn server:ci with MongoDB 3.6
  277. working-directory: ./packages/app
  278. run: |
  279. cp config/ci/.env.local.for-ci .env.production.local
  280. yarn server:ci
  281. env:
  282. MONGO_URI: mongodb://localhost:${{ job.services.mongodb36.ports['27017'] }}/growi
  283. - name: Slack Notification
  284. uses: weseek/ghaction-slack-notification@master
  285. if: failure()
  286. with:
  287. type: ${{ job.status }}
  288. job_name: '*Node CI for growi - build-prod (14.x)*'
  289. channel: '#ci'
  290. isCompactMode: true
  291. url: ${{ secrets.SLACK_WEBHOOK_URL }}