ci.yml 4.3 KB

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