ci-app.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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 --scope @growi/app --scope @growi/codemirror-textlint --scope @growi/core --scope @growi/slack --scope @growi/ui
  54. - name: Slack Notification
  55. uses: weseek/ghaction-slack-notification@master
  56. if: failure()
  57. with:
  58. type: ${{ job.status }}
  59. job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  60. channel: '#ci'
  61. isCompactMode: true
  62. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  63. test:
  64. runs-on: ubuntu-latest
  65. strategy:
  66. matrix:
  67. node-version: [16.x]
  68. services:
  69. mongodb:
  70. image: mongo:4.4
  71. ports:
  72. - 27017/tcp
  73. steps:
  74. - uses: actions/checkout@v3
  75. - uses: actions/setup-node@v3
  76. with:
  77. node-version: ${{ matrix.node-version }}
  78. cache: 'yarn'
  79. cache-dependency-path: '**/yarn.lock'
  80. - name: Cache/Restore node_modules
  81. id: cache-dependencies
  82. uses: actions/cache@v3
  83. with:
  84. path: |
  85. **/node_modules
  86. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  87. restore-keys: |
  88. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  89. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  90. - name: lerna bootstrap
  91. run: |
  92. npx lerna bootstrap -- --frozen-lockfile
  93. - name: lerna run test for plugins
  94. run: |
  95. yarn lerna run test --scope @growi/remark-growi-plugin --scope @growi/plugin-*
  96. - name: Test app
  97. working-directory: ./packages/app
  98. run: |
  99. yarn test:ci --selectProjects unit server ; yarn test:ci --selectProjects server-v5
  100. env:
  101. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  102. - name: Upload coverage report as artifact
  103. uses: actions/upload-artifact@v3
  104. with:
  105. name: Coverage Report
  106. path: |
  107. packages/app/coverage
  108. packages/remark-growi-plugin/coverage
  109. - name: Slack Notification
  110. uses: weseek/ghaction-slack-notification@master
  111. if: failure()
  112. with:
  113. type: ${{ job.status }}
  114. job_name: '*Node CI for growi - test (${{ matrix.node-version }})*'
  115. channel: '#ci'
  116. isCompactMode: true
  117. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  118. launch-dev:
  119. runs-on: ubuntu-latest
  120. strategy:
  121. matrix:
  122. node-version: [16.x]
  123. services:
  124. mongodb:
  125. image: mongo:4.4
  126. ports:
  127. - 27017/tcp
  128. steps:
  129. - uses: actions/checkout@v3
  130. - uses: actions/setup-node@v3
  131. with:
  132. node-version: ${{ matrix.node-version }}
  133. cache: 'yarn'
  134. cache-dependency-path: '**/yarn.lock'
  135. - name: Cache/Restore node_modules and next cache files
  136. id: cache-dependencies
  137. uses: actions/cache@v3
  138. with:
  139. path: |
  140. **/node_modules
  141. ${{ github.workspace }}/packages/app/.next/cache
  142. key: dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  143. restore-keys: |
  144. dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  145. dev-${{ runner.OS }}-node${{ matrix.node-version }}-
  146. - name: lerna bootstrap
  147. run: |
  148. npx lerna bootstrap -- --frozen-lockfile
  149. - name: yarn dev:ci
  150. working-directory: ./packages/app
  151. run: |
  152. cp config/ci/.env.local.for-ci .env.development.local
  153. yarn dev:ci
  154. env:
  155. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  156. - name: Slack Notification
  157. uses: weseek/ghaction-slack-notification@master
  158. if: failure()
  159. with:
  160. type: ${{ job.status }}
  161. job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  162. channel: '#ci'
  163. isCompactMode: true
  164. url: ${{ secrets.SLACK_WEBHOOK_URL }}