ci-app.yml 5.8 KB

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