ci.yml 4.3 KB

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