2
0

ci.yml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. name: Node CI
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - tmp/**
  7. jobs:
  8. lint:
  9. runs-on: ubuntu-latest
  10. strategy:
  11. matrix:
  12. node-version: [12.x]
  13. steps:
  14. - uses: actions/checkout@v2
  15. - name: Use Node.js ${{ matrix.node-version }}
  16. uses: actions/setup-node@v1
  17. with:
  18. node-version: ${{ matrix.node-version }}
  19. - name: Cache/Restore node_modules
  20. id: cache-dependencies
  21. uses: actions/cache@v1
  22. with:
  23. path: node_modules
  24. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  25. - name: Get yarn cache dir
  26. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  27. id: cache-yarn
  28. run: echo "::set-output name=dir::$(yarn cache dir)"
  29. - name: Cache/Restore yarn cache
  30. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  31. uses: actions/cache@v1
  32. with:
  33. path: ${{ steps.cache-yarn.outputs.dir }}
  34. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  35. restore-keys: |
  36. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  37. - name: Install dependencies
  38. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  39. run: |
  40. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs react-images@1.0.0 react-motion
  41. - name: Print dependencies
  42. run: |
  43. echo -n "node " && node -v
  44. echo -n "npm " && npm -v
  45. yarn list --depth=0
  46. - name: yarn lint
  47. run: |
  48. yarn lint
  49. - name: Slack Notification
  50. uses: homoluctus/slatify@master
  51. if: failure()
  52. with:
  53. type: ${{ job.status }}
  54. job_name: '*test (${{ matrix.node-version }})*'
  55. channel: '#ci'
  56. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  57. test:
  58. runs-on: ubuntu-latest
  59. strategy:
  60. matrix:
  61. node-version: [12.x]
  62. steps:
  63. - uses: actions/checkout@v2
  64. - name: Use Node.js ${{ matrix.node-version }}
  65. uses: actions/setup-node@v1
  66. with:
  67. node-version: ${{ matrix.node-version }}
  68. - name: Cache/Restore node_modules
  69. id: cache-dependencies
  70. uses: actions/cache@v1
  71. with:
  72. path: node_modules
  73. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  74. - name: Get yarn cache dir
  75. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  76. id: cache-yarn
  77. run: echo "::set-output name=dir::$(yarn cache dir)"
  78. - name: Cache/Restore yarn cache
  79. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  80. uses: actions/cache@v1
  81. with:
  82. path: ${{ steps.cache-yarn.outputs.dir }}
  83. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  84. restore-keys: |
  85. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  86. - name: Install dependencies
  87. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  88. run: |
  89. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs react-images@1.0.0 react-motion
  90. - name: Print dependencies
  91. run: |
  92. echo -n "node " && node -v
  93. echo -n "npm " && npm -v
  94. yarn list --depth=0
  95. - name: Launch MongoDB
  96. uses: wbari/start-mongoDB@v0.2
  97. with:
  98. mongoDBVersion: 3.6
  99. - name: yarn test
  100. run: |
  101. yarn test
  102. env:
  103. MONGO_URI: mongodb://localhost:27017/growi_test
  104. - name: Slack Notification
  105. uses: homoluctus/slatify@master
  106. if: failure()
  107. with:
  108. type: ${{ job.status }}
  109. job_name: '*test (${{ matrix.node-version }})*'
  110. channel: '#ci'
  111. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  112. build-dev:
  113. runs-on: ubuntu-latest
  114. strategy:
  115. matrix:
  116. node-version: [12.x]
  117. steps:
  118. - uses: actions/checkout@v2
  119. - name: Use Node.js ${{ matrix.node-version }}
  120. uses: actions/setup-node@v1
  121. with:
  122. node-version: ${{ matrix.node-version }}
  123. - name: Cache/Restore node_modules
  124. id: cache-dependencies
  125. uses: actions/cache@v1
  126. with:
  127. path: node_modules
  128. key: ${{ runner.OS }}-node_modules_dev-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  129. - name: Get Date
  130. run: |
  131. echo ::set-env name=DateYmdHM::$(date '+%Y%m%d%H%M')
  132. echo ::set-env name=DateYmdH::$(date '+%Y%m%d%H')
  133. echo ::set-env name=DateYmd::$(date '+%Y%m%d')
  134. echo ::set-env name=DateYm::$(date '+%Y%m')
  135. echo ::set-env name=DateY::$(date '+%Y')
  136. - name: Cache/Restore node_modules/.cache/hard-source
  137. uses: actions/cache@v1
  138. with:
  139. path: node_modules/.cache
  140. key: ${{ runner.OS }}-hard_source_webpack_dev-${{ matrix.node-version }}-${{ env.DateYmdHM }}
  141. restore-keys: |
  142. ${{ runner.os }}-hard_source_webpack_dev-${{ matrix.node-version }}-${{ env.DateYmdH }}
  143. ${{ runner.os }}-hard_source_webpack_dev-${{ matrix.node-version }}-${{ env.DateYmd }}
  144. ${{ runner.os }}-hard_source_webpack_dev-${{ matrix.node-version }}-${{ env.DateYm }}
  145. ${{ runner.os }}-hard_source_webpack_dev-${{ matrix.node-version }}-${{ env.DateY }}
  146. - name: Get yarn cache dir
  147. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  148. id: cache-yarn
  149. run: echo "::set-output name=dir::$(yarn cache dir)"
  150. - name: Cache/Restore yarn cache
  151. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  152. uses: actions/cache@v1
  153. with:
  154. path: ${{ steps.cache-yarn.outputs.dir }}
  155. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  156. restore-keys: |
  157. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  158. - name: Install dependencies
  159. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  160. run: |
  161. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs react-images@1.0.0 react-motion
  162. - name: Print dependencies
  163. run: |
  164. echo -n "node " && node -v
  165. echo -n "npm " && npm -v
  166. yarn list --depth=0
  167. - name: yarn build:dev
  168. run: |
  169. yarn build:dev
  170. - name: Slack Notification
  171. uses: homoluctus/slatify@master
  172. if: failure()
  173. with:
  174. type: ${{ job.status }}
  175. job_name: '*build-dev (${{ matrix.node-version }})*'
  176. channel: '#ci'
  177. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  178. build-prod:
  179. runs-on: ubuntu-latest
  180. strategy:
  181. matrix:
  182. node-version: [10.x, 12.x]
  183. steps:
  184. - uses: actions/checkout@v2
  185. - name: Use Node.js ${{ matrix.node-version }}
  186. uses: actions/setup-node@v1
  187. with:
  188. node-version: ${{ matrix.node-version }}
  189. - name: Get Date
  190. run: |
  191. echo ::set-env name=DateYmdHM::$(date '+%Y%m%d%H%M')
  192. echo ::set-env name=DateYmdH::$(date '+%Y%m%d%H')
  193. echo ::set-env name=DateYmd::$(date '+%Y%m%d')
  194. echo ::set-env name=DateYm::$(date '+%Y%m')
  195. echo ::set-env name=DateY::$(date '+%Y')
  196. - name: Cache/Restore node_modules
  197. uses: actions/cache@v1
  198. with:
  199. path: node_modules
  200. key: ${{ runner.OS }}-node_modules_prod-${{ matrix.node-version }}-${{ env.DateYmdHM }}
  201. restore-keys: |
  202. ${{ runner.os }}-node_modules_prod-${{ matrix.node-version }}-${{ env.DateYmdH }}
  203. ${{ runner.os }}-node_modules_prod-${{ matrix.node-version }}-${{ env.DateYmd }}
  204. ${{ runner.os }}-node_modules_prod-${{ matrix.node-version }}-${{ env.DateYm }}
  205. ${{ runner.os }}-node_modules_prod-${{ matrix.node-version }}-${{ env.DateY }}
  206. - name: Get yarn cache dir
  207. id: cache-yarn
  208. run: echo "::set-output name=dir::$(yarn cache dir)"
  209. - name: Cache/Restore yarn cache
  210. uses: actions/cache@v1
  211. with:
  212. path: ${{ steps.cache-yarn.outputs.dir }}
  213. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  214. restore-keys: |
  215. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  216. - name: Install dependencies
  217. run: |
  218. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs
  219. yarn add -D react-images@1.0.0 react-motion
  220. - name: Print dependencies
  221. run: |
  222. echo -n "node " && node -v
  223. echo -n "npm " && npm -v
  224. yarn list --depth=0
  225. - name: yarn build:prod:analyze
  226. run: |
  227. yarn build:prod:analyze
  228. - name: yarn install --production
  229. run: |
  230. yarn install --production
  231. - name: Print dependencies
  232. run: |
  233. echo -n "node " && node -v
  234. echo -n "npm " && npm -v
  235. yarn list --production --depth=0
  236. - name: Launch MongoDB
  237. uses: wbari/start-mongoDB@v0.2
  238. with:
  239. mongoDBVersion: 3.6
  240. - name: yarn server:prod:ci
  241. run: |
  242. yarn server:prod:ci
  243. env:
  244. MONGO_URI: mongodb://localhost:27017/growi
  245. - name: Upload report as artifact
  246. uses: actions/upload-artifact@v1
  247. with:
  248. name: Report
  249. path: report
  250. - name: Slack Notification
  251. uses: homoluctus/slatify@master
  252. if: failure()
  253. with:
  254. type: ${{ job.status }}
  255. job_name: '*build-prod (${{ matrix.node-version }})*'
  256. channel: '#ci'
  257. url: ${{ secrets.SLACK_WEBHOOK_URL }}