ci.yml 7.3 KB

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