ci.yml 7.4 KB

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