ci.yml 4.3 KB

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