ci.yml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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: 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@v1
  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@v1
  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-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  129. - name: Get yarn cache dir
  130. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  131. id: cache-yarn
  132. run: echo "::set-output name=dir::$(yarn cache dir)"
  133. - name: Cache/Restore yarn cache
  134. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  135. uses: actions/cache@v1
  136. with:
  137. path: ${{ steps.cache-yarn.outputs.dir }}
  138. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  139. restore-keys: |
  140. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  141. - name: Install dependencies
  142. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  143. run: |
  144. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs react-images@1.0.0 react-motion
  145. - name: Print dependencies
  146. run: |
  147. echo -n "node " && node -v
  148. echo -n "npm " && npm -v
  149. yarn list --depth=0
  150. - name: yarn build:dev
  151. run: |
  152. yarn build:dev
  153. - name: Slack Notification
  154. uses: homoluctus/slatify@master
  155. if: failure()
  156. with:
  157. type: ${{ job.status }}
  158. job_name: '*build-dev (${{ matrix.node-version }})*'
  159. channel: '#ci'
  160. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  161. build-prod:
  162. runs-on: ubuntu-latest
  163. strategy:
  164. matrix:
  165. node-version: [10.x, 12.x]
  166. steps:
  167. - uses: actions/checkout@v1
  168. - name: Use Node.js ${{ matrix.node-version }}
  169. uses: actions/setup-node@v1
  170. with:
  171. node-version: ${{ matrix.node-version }}
  172. - name: Get yarn cache dir
  173. id: cache-yarn
  174. run: echo "::set-output name=dir::$(yarn cache dir)"
  175. - name: Cache/Restore yarn cache
  176. uses: actions/cache@v1
  177. with:
  178. path: ${{ steps.cache-yarn.outputs.dir }}
  179. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  180. restore-keys: |
  181. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  182. - name: Install dependencies
  183. run: |
  184. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs
  185. yarn add -D react-images@1.0.0 react-motion
  186. - name: Print dependencies
  187. run: |
  188. echo -n "node " && node -v
  189. echo -n "npm " && npm -v
  190. yarn list --depth=0
  191. - name: yarn build:prod
  192. run: |
  193. yarn build:prod
  194. - name: yarn install --production
  195. run: |
  196. yarn install --production
  197. - name: Print dependencies
  198. run: |
  199. echo -n "node " && node -v
  200. echo -n "npm " && npm -v
  201. yarn list --production --depth=0
  202. - name: Launch MongoDB
  203. uses: wbari/start-mongoDB@v0.2
  204. with:
  205. mongoDBVersion: 3.6
  206. - name: yarn server:prod:ci
  207. run: |
  208. yarn server:prod:ci
  209. env:
  210. MONGO_URI: mongodb://localhost:27017/growi
  211. - name: Slack Notification
  212. uses: homoluctus/slatify@master
  213. if: failure()
  214. with:
  215. type: ${{ job.status }}
  216. job_name: '*build-prod (${{ matrix.node-version }})*'
  217. channel: '#ci'
  218. url: ${{ secrets.SLACK_WEBHOOK_URL }}