ci-app.yml 5.8 KB

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