ci.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. name: Node CI
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - tmp/**
  7. jobs:
  8. test:
  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
  21. uses: actions/cache@v1
  22. with:
  23. path: node_modules
  24. key: ${{ runner.OS }}-node_modules-dev-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  25. - name: Install dependencies
  26. if: steps.cache.outputs.cache-hit != 'true'
  27. run: |
  28. yarn
  29. - name: Print dependencies
  30. run: |
  31. echo -n "node " && node -v
  32. echo -n "npm " && npm -v
  33. yarn list --depth=0
  34. - name: yarn lint
  35. run: |
  36. yarn lint
  37. - name: Launch MongoDB
  38. uses: wbari/start-mongoDB@v0.2
  39. with:
  40. mongoDBVersion: 3.6
  41. - name: yarn test
  42. run: |
  43. yarn test
  44. env:
  45. MONGO_URI: mongodb://localhost:27017/growi_test
  46. - name: Slack Notification
  47. uses: homoluctus/slatify@master
  48. if: failure()
  49. with:
  50. type: ${{ job.status }}
  51. job_name: '*test (${{ matrix.node-version }})*'
  52. channel: '#ci'
  53. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  54. build-dev:
  55. runs-on: ubuntu-latest
  56. strategy:
  57. matrix:
  58. node-version: [12.x]
  59. steps:
  60. - uses: actions/checkout@v1
  61. - name: Use Node.js ${{ matrix.node-version }}
  62. uses: actions/setup-node@v1
  63. with:
  64. node-version: ${{ matrix.node-version }}
  65. - name: Cache/Restore node_modules
  66. id: cache
  67. uses: actions/cache@v1
  68. with:
  69. path: node_modules
  70. key: ${{ runner.OS }}-node_modules-dev-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  71. - name: Install dependencies
  72. if: steps.cache.outputs.cache-hit != 'true'
  73. run: |
  74. yarn
  75. - name: Print dependencies
  76. run: |
  77. echo -n "node " && node -v
  78. echo -n "npm " && npm -v
  79. yarn list --depth=0
  80. - name: yarn build:dev
  81. run: |
  82. yarn build:dev
  83. - name: Slack Notification
  84. uses: homoluctus/slatify@master
  85. if: failure()
  86. with:
  87. type: ${{ job.status }}
  88. job_name: '*build-dev (${{ matrix.node-version }})*'
  89. channel: '#ci'
  90. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  91. build-prod:
  92. runs-on: ubuntu-latest
  93. strategy:
  94. matrix:
  95. node-version: [10.x, 12.x]
  96. steps:
  97. - uses: actions/checkout@v1
  98. - name: Use Node.js ${{ matrix.node-version }}
  99. uses: actions/setup-node@v1
  100. with:
  101. node-version: ${{ matrix.node-version }}
  102. - name: Cache/Restore node_modules
  103. id: cache
  104. uses: actions/cache@v1
  105. with:
  106. path: node_modules
  107. key: ${{ runner.OS }}-node_modules-dev-with-plugins-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  108. - name: Install dependencies
  109. if: steps.cache.outputs.cache-hit != 'true'
  110. run: |
  111. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs react-images react-motion
  112. - name: Print dependencies
  113. run: |
  114. echo -n "node " && node -v
  115. echo -n "npm " && npm -v
  116. yarn list --depth=0
  117. - name: yarn build:prod:analyze
  118. run: |
  119. yarn build:prod:analyze
  120. - name: Upload reports
  121. uses: actions/upload-artifact@v1
  122. if: success()
  123. with:
  124. name: report
  125. path: report
  126. - name: Slack Notification
  127. uses: homoluctus/slatify@master
  128. if: failure()
  129. with:
  130. type: ${{ job.status }}
  131. job_name: '*build-prod (${{ matrix.node-version }})*'
  132. channel: '#ci'
  133. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  134. server-prod:
  135. runs-on: ubuntu-latest
  136. strategy:
  137. matrix:
  138. node-version: [10.x, 12.x]
  139. steps:
  140. - uses: actions/checkout@v1
  141. - name: Use Node.js ${{ matrix.node-version }}
  142. uses: actions/setup-node@v1
  143. with:
  144. node-version: ${{ matrix.node-version }}
  145. - name: Cache/Restore node_modules
  146. id: cache
  147. uses: actions/cache@v1
  148. with:
  149. path: node_modules
  150. key: ${{ runner.OS }}-node_modules-prod-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  151. - name: Install dependencies
  152. if: steps.cache.outputs.cache-hit != 'true'
  153. run: |
  154. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs
  155. - name: Print dependencies
  156. run: |
  157. echo -n "node " && node -v
  158. echo -n "npm " && npm -v
  159. yarn list --depth=0
  160. - name: Launch MongoDB
  161. uses: wbari/start-mongoDB@v0.2
  162. with:
  163. mongoDBVersion: 3.6
  164. - name: yarn server:prod:ci
  165. run: |
  166. yarn server:prod:ci
  167. env:
  168. MONGO_URI: mongodb://localhost:27017/growi
  169. - name: Slack Notification
  170. uses: homoluctus/slatify@master
  171. if: failure()
  172. with:
  173. type: ${{ job.status }}
  174. job_name: '*build-prod (${{ matrix.node-version }})*'
  175. channel: '#ci'
  176. url: ${{ secrets.SLACK_WEBHOOK_URL }}