ci.yml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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@v1
  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: build swagger.json
  47. run: yarn run build:apiv3:jsdoc
  48. - name: cat swagger.json
  49. run: cat tmp/swagger.json
  50. - name: grub
  51. run: ls -al src/server/**/*.js
  52. - name: yarn lint
  53. run: |
  54. yarn lint
  55. - name: Slack Notification
  56. uses: homoluctus/slatify@master
  57. if: failure()
  58. with:
  59. type: ${{ job.status }}
  60. job_name: '*test (${{ matrix.node-version }})*'
  61. channel: '#ci'
  62. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  63. test:
  64. runs-on: ubuntu-latest
  65. strategy:
  66. matrix:
  67. node-version: [12.x]
  68. steps:
  69. - uses: actions/checkout@v1
  70. - name: Use Node.js ${{ matrix.node-version }}
  71. uses: actions/setup-node@v1
  72. with:
  73. node-version: ${{ matrix.node-version }}
  74. - name: Cache/Restore node_modules
  75. id: cache-dependencies
  76. uses: actions/cache@v1
  77. with:
  78. path: node_modules
  79. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  80. - name: Get yarn cache dir
  81. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  82. id: cache-yarn
  83. run: echo "::set-output name=dir::$(yarn cache dir)"
  84. - name: Cache/Restore yarn cache
  85. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  86. uses: actions/cache@v1
  87. with:
  88. path: ${{ steps.cache-yarn.outputs.dir }}
  89. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  90. restore-keys: |
  91. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  92. - name: Install dependencies
  93. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  94. run: |
  95. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs react-images@1.0.0 react-motion
  96. - name: Print dependencies
  97. run: |
  98. echo -n "node " && node -v
  99. echo -n "npm " && npm -v
  100. yarn list --depth=0
  101. - name: Launch MongoDB
  102. uses: wbari/start-mongoDB@v0.2
  103. with:
  104. mongoDBVersion: 3.6
  105. - name: yarn test
  106. run: |
  107. yarn test
  108. env:
  109. MONGO_URI: mongodb://localhost:27017/growi_test
  110. - name: Slack Notification
  111. uses: homoluctus/slatify@master
  112. if: failure()
  113. with:
  114. type: ${{ job.status }}
  115. job_name: '*test (${{ matrix.node-version }})*'
  116. channel: '#ci'
  117. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  118. build-dev:
  119. runs-on: ubuntu-latest
  120. strategy:
  121. matrix:
  122. node-version: [12.x]
  123. steps:
  124. - uses: actions/checkout@v1
  125. - name: Use Node.js ${{ matrix.node-version }}
  126. uses: actions/setup-node@v1
  127. with:
  128. node-version: ${{ matrix.node-version }}
  129. - name: Cache/Restore node_modules
  130. id: cache-dependencies
  131. uses: actions/cache@v1
  132. with:
  133. path: node_modules
  134. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  135. - name: Get yarn cache dir
  136. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  137. id: cache-yarn
  138. run: echo "::set-output name=dir::$(yarn cache dir)"
  139. - name: Cache/Restore yarn cache
  140. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  141. uses: actions/cache@v1
  142. with:
  143. path: ${{ steps.cache-yarn.outputs.dir }}
  144. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  145. restore-keys: |
  146. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  147. - name: Install dependencies
  148. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  149. run: |
  150. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs react-images@1.0.0 react-motion
  151. - name: Print dependencies
  152. run: |
  153. echo -n "node " && node -v
  154. echo -n "npm " && npm -v
  155. yarn list --depth=0
  156. - name: yarn build:dev
  157. run: |
  158. yarn build:dev
  159. - name: Slack Notification
  160. uses: homoluctus/slatify@master
  161. if: failure()
  162. with:
  163. type: ${{ job.status }}
  164. job_name: '*build-dev (${{ matrix.node-version }})*'
  165. channel: '#ci'
  166. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  167. build-prod:
  168. runs-on: ubuntu-latest
  169. strategy:
  170. matrix:
  171. node-version: [10.x, 12.x]
  172. steps:
  173. - uses: actions/checkout@v1
  174. - name: Use Node.js ${{ matrix.node-version }}
  175. uses: actions/setup-node@v1
  176. with:
  177. node-version: ${{ matrix.node-version }}
  178. - name: Get yarn cache dir
  179. id: cache-yarn
  180. run: echo "::set-output name=dir::$(yarn cache dir)"
  181. - name: Cache/Restore yarn cache
  182. uses: actions/cache@v1
  183. with:
  184. path: ${{ steps.cache-yarn.outputs.dir }}
  185. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  186. restore-keys: |
  187. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  188. - name: Install dependencies
  189. run: |
  190. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs
  191. yarn add -D react-images@1.0.0 react-motion
  192. - name: Print dependencies
  193. run: |
  194. echo -n "node " && node -v
  195. echo -n "npm " && npm -v
  196. yarn list --depth=0
  197. - name: yarn build:prod
  198. run: |
  199. yarn build:prod
  200. - name: yarn install --production
  201. run: |
  202. yarn install --production
  203. - name: Print dependencies
  204. run: |
  205. echo -n "node " && node -v
  206. echo -n "npm " && npm -v
  207. yarn list --production --depth=0
  208. - name: Launch MongoDB
  209. uses: wbari/start-mongoDB@v0.2
  210. with:
  211. mongoDBVersion: 3.6
  212. - name: yarn server:prod:ci
  213. run: |
  214. yarn server:prod:ci
  215. env:
  216. MONGO_URI: mongodb://localhost:27017/growi
  217. - name: Slack Notification
  218. uses: homoluctus/slatify@master
  219. if: failure()
  220. with:
  221. type: ${{ job.status }}
  222. job_name: '*build-prod (${{ matrix.node-version }})*'
  223. channel: '#ci'
  224. url: ${{ secrets.SLACK_WEBHOOK_URL }}