ci.yml 9.6 KB

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