ci.yml 8.6 KB

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