ci.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. name: Node CI for growi
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - rc/**
  7. - chore/**
  8. - support/prepare-v**
  9. jobs:
  10. lint:
  11. runs-on: ubuntu-latest
  12. strategy:
  13. matrix:
  14. node-version: [16.x]
  15. steps:
  16. - uses: actions/checkout@v2
  17. - uses: actions/setup-node@v2
  18. with:
  19. node-version: ${{ matrix.node-version }}
  20. cache: 'yarn'
  21. cache-dependency-path: '**/yarn.lock'
  22. - name: lerna bootstrap
  23. run: |
  24. npx lerna bootstrap
  25. - name: Print dependencies
  26. run: |
  27. echo -n "node " && node -v
  28. echo -n "npm " && npm -v
  29. yarn list --depth=0
  30. - name: lerna run lint for plugins
  31. run: |
  32. yarn lerna run lint --scope @growi/plugin-*
  33. - name: lerna run lint for app
  34. run: |
  35. yarn lerna run lint --scope @growi/app --scope @growi/core --scope @growi/ui
  36. - name: Slack Notification
  37. uses: weseek/ghaction-slack-notification@master
  38. if: failure()
  39. with:
  40. type: ${{ job.status }}
  41. job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  42. channel: '#ci'
  43. isCompactMode: true
  44. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  45. test:
  46. runs-on: ubuntu-latest
  47. strategy:
  48. matrix:
  49. node-version: [16.x]
  50. services:
  51. mongodb:
  52. image: mongo:4.4
  53. ports:
  54. - 27017/tcp
  55. steps:
  56. - uses: actions/checkout@v2
  57. - uses: actions/setup-node@v2
  58. with:
  59. node-version: ${{ matrix.node-version }}
  60. cache: 'yarn'
  61. cache-dependency-path: '**/yarn.lock'
  62. - name: lerna bootstrap
  63. run: |
  64. npx lerna bootstrap
  65. - name: Print dependencies
  66. run: |
  67. echo -n "node " && node -v
  68. echo -n "npm " && npm -v
  69. yarn list --depth=0
  70. - name: yarn test
  71. working-directory: ./packages/app
  72. run: |
  73. yarn test
  74. env:
  75. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  76. - name: Upload coverage report as artifact
  77. uses: actions/upload-artifact@v2
  78. with:
  79. name: Coverage Report
  80. path: packages/app/coverage
  81. - name: Slack Notification
  82. uses: weseek/ghaction-slack-notification@master
  83. if: failure()
  84. with:
  85. type: ${{ job.status }}
  86. job_name: '*Node CI for growi - test (${{ matrix.node-version }})*'
  87. channel: '#ci'
  88. isCompactMode: true
  89. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  90. launch-dev:
  91. runs-on: ubuntu-latest
  92. strategy:
  93. matrix:
  94. node-version: [16.x]
  95. services:
  96. mongodb:
  97. image: mongo:4.4
  98. ports:
  99. - 27017/tcp
  100. steps:
  101. - uses: actions/checkout@v2
  102. - uses: actions/setup-node@v2
  103. with:
  104. node-version: ${{ matrix.node-version }}
  105. cache: 'yarn'
  106. cache-dependency-path: '**/yarn.lock'
  107. - name: lerna bootstrap
  108. run: |
  109. npx lerna bootstrap
  110. - name: Print dependencies
  111. run: |
  112. echo -n "node " && node -v
  113. echo -n "npm " && npm -v
  114. yarn list --depth=0
  115. - name: yarn dev:ci
  116. working-directory: ./packages/app
  117. run: |
  118. cp config/ci/.env.local.for-ci .env.development.local
  119. yarn dev:ci
  120. env:
  121. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  122. - name: Slack Notification
  123. uses: weseek/ghaction-slack-notification@master
  124. if: failure()
  125. with:
  126. type: ${{ job.status }}
  127. job_name: '*Node CI for growi - build-dev (${{ matrix.node-version }})*'
  128. channel: '#ci'
  129. isCompactMode: true
  130. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  131. launch-prod:
  132. runs-on: ubuntu-latest
  133. strategy:
  134. matrix:
  135. node-version: [14.x, 16.x]
  136. services:
  137. mongodb:
  138. image: mongo:4.4
  139. ports:
  140. - 27017/tcp
  141. steps:
  142. - uses: actions/checkout@v2
  143. - uses: actions/setup-node@v2
  144. with:
  145. node-version: ${{ matrix.node-version }}
  146. cache: 'yarn'
  147. cache-dependency-path: '**/yarn.lock'
  148. - name: Remove unnecessary packages
  149. run: |
  150. rm -rf packages/slackbot-proxy
  151. - name: lerna bootstrap
  152. run: |
  153. npx lerna bootstrap
  154. - name: Print dependencies
  155. run: |
  156. echo -n "node " && node -v
  157. echo -n "npm " && npm -v
  158. yarn list --depth=0
  159. - name: Build
  160. run: |
  161. yarn lerna run build
  162. env:
  163. ANALYZE_BUNDLE_SIZE: ${{ matrix.node-version == '16.x' }}
  164. - name: lerna bootstrap --production
  165. run: |
  166. npx lerna bootstrap -- --production
  167. - name: Print dependencies
  168. run: |
  169. echo -n "node " && node -v
  170. echo -n "npm " && npm -v
  171. yarn list --production --depth=0
  172. - name: Get DB name
  173. id: getdbname
  174. run: |
  175. echo ::set-output name=suffix::$(echo '${{ matrix.node-version }}' | sed s/\\.//)
  176. - name: yarn server:ci
  177. working-directory: ./packages/app
  178. run: |
  179. cp config/ci/.env.local.for-ci .env.production.local
  180. yarn server:ci
  181. env:
  182. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi-${{ steps.getdbname.outputs.suffix }}
  183. - name: Upload report as artifact
  184. uses: actions/upload-artifact@v2
  185. with:
  186. name: Bundle Analyzing Report
  187. path: packages/app/report/bundle-analyzer.html
  188. - name: Slack Notification
  189. uses: weseek/ghaction-slack-notification@master
  190. if: failure()
  191. with:
  192. type: ${{ job.status }}
  193. job_name: '*Node CI for growi - build-prod (${{ matrix.node-version }})*'
  194. channel: '#ci'
  195. isCompactMode: true
  196. url: ${{ secrets.SLACK_WEBHOOK_URL }}