ci-app.yml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. name: Node CI for app development
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - rc/**
  7. - chore/**
  8. - support/prepare-v**
  9. paths:
  10. - .github/workflows/ci-app.yml
  11. - .eslint*
  12. - tsconfig.base.json
  13. - yarn.lock
  14. - packages/app/**
  15. - '!packages/app/docker/**'
  16. - packages/codemirror-textlint/**
  17. - packages/core/**
  18. - packages/remark-growi-plugin/**
  19. - packages/slack/**
  20. - packages/ui/**
  21. - packages/plugin-*/**
  22. jobs:
  23. lint:
  24. runs-on: ubuntu-latest
  25. strategy:
  26. matrix:
  27. node-version: [16.x]
  28. steps:
  29. - uses: actions/checkout@v3
  30. - uses: actions/setup-node@v3
  31. with:
  32. node-version: ${{ matrix.node-version }}
  33. cache: 'yarn'
  34. cache-dependency-path: '**/yarn.lock'
  35. - name: Cache/Restore node_modules
  36. id: cache-dependencies
  37. uses: actions/cache@v3
  38. with:
  39. path: |
  40. **/node_modules
  41. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  42. restore-keys: |
  43. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  44. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  45. - name: lerna bootstrap
  46. run: |
  47. npx lerna bootstrap -- --frozen-lockfile
  48. - name: lerna run lint for plugins
  49. run: |
  50. yarn lerna run lint --scope @growi/remark-growi-plugin --scope @growi/plugin-*
  51. - name: lerna run lint for app
  52. run: |
  53. yarn lerna run lint \
  54. --scope @growi/app \
  55. --scope @growi/codemirror-textlint \
  56. --scope @growi/core \
  57. --scope @growi/slack
  58. --scope @growi/ui
  59. - name: Slack Notification
  60. uses: weseek/ghaction-slack-notification@master
  61. if: failure()
  62. with:
  63. type: ${{ job.status }}
  64. job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  65. channel: '#ci'
  66. isCompactMode: true
  67. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  68. test:
  69. runs-on: ubuntu-latest
  70. strategy:
  71. matrix:
  72. node-version: [16.x]
  73. services:
  74. mongodb:
  75. image: mongo:4.4
  76. ports:
  77. - 27017/tcp
  78. steps:
  79. - uses: actions/checkout@v3
  80. - uses: actions/setup-node@v3
  81. with:
  82. node-version: ${{ matrix.node-version }}
  83. cache: 'yarn'
  84. cache-dependency-path: '**/yarn.lock'
  85. - name: Cache/Restore node_modules
  86. id: cache-dependencies
  87. uses: actions/cache@v3
  88. with:
  89. path: |
  90. **/node_modules
  91. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  92. restore-keys: |
  93. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  94. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  95. - name: lerna bootstrap
  96. run: |
  97. npx lerna bootstrap -- --frozen-lockfile
  98. - name: lerna run test for plugins
  99. run: |
  100. yarn lerna run test --scope @growi/remark-growi-plugin --scope @growi/plugin-*
  101. - name: Test app
  102. working-directory: ./packages/app
  103. run: |
  104. yarn test:ci --selectProjects unit server ; yarn test:ci --selectProjects server-v5
  105. env:
  106. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  107. - name: Upload coverage report as artifact
  108. uses: actions/upload-artifact@v3
  109. with:
  110. name: Coverage Report
  111. path: |
  112. packages/app/coverage
  113. packages/remark-growi-plugin/coverage
  114. - name: Slack Notification
  115. uses: weseek/ghaction-slack-notification@master
  116. if: failure()
  117. with:
  118. type: ${{ job.status }}
  119. job_name: '*Node CI for growi - test (${{ matrix.node-version }})*'
  120. channel: '#ci'
  121. isCompactMode: true
  122. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  123. launch-dev:
  124. runs-on: ubuntu-latest
  125. strategy:
  126. matrix:
  127. node-version: [16.x]
  128. services:
  129. mongodb:
  130. image: mongo:4.4
  131. ports:
  132. - 27017/tcp
  133. steps:
  134. - uses: actions/checkout@v3
  135. - uses: actions/setup-node@v3
  136. with:
  137. node-version: ${{ matrix.node-version }}
  138. cache: 'yarn'
  139. cache-dependency-path: '**/yarn.lock'
  140. - name: Cache/Restore node_modules and next cache files
  141. id: cache-dependencies
  142. uses: actions/cache@v3
  143. with:
  144. path: |
  145. **/node_modules
  146. ${{ github.workspace }}/packages/app/.next/cache
  147. key: dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  148. restore-keys: |
  149. dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  150. dev-${{ runner.OS }}-node${{ matrix.node-version }}-
  151. - name: lerna bootstrap
  152. run: |
  153. npx lerna bootstrap -- --frozen-lockfile
  154. - name: yarn dev:ci
  155. working-directory: ./packages/app
  156. run: |
  157. cp config/ci/.env.local.for-ci .env.development.local
  158. yarn dev:ci
  159. env:
  160. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  161. - name: Slack Notification
  162. uses: weseek/ghaction-slack-notification@master
  163. if: failure()
  164. with:
  165. type: ${{ job.status }}
  166. job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  167. channel: '#ci'
  168. isCompactMode: true
  169. url: ${{ secrets.SLACK_WEBHOOK_URL }}