ci-app.yml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. name: Node CI for app development
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - rc/**
  7. paths:
  8. - .github/workflows/ci-app.yml
  9. - .eslint*
  10. - tsconfig.base.json
  11. - yarn.lock
  12. - packages/app/**
  13. - '!packages/app/docker/**'
  14. - packages/codemirror-textlint/**
  15. - packages/core/**
  16. - packages/remark-*/**
  17. - packages/slack/**
  18. - packages/ui/**
  19. concurrency:
  20. group: ${{ github.workflow }}-${{ github.ref }}
  21. cancel-in-progress: true
  22. jobs:
  23. lint:
  24. runs-on: ubuntu-latest
  25. if: startsWith(github.ref, 'refs/heads/support/prepare-v')
  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 dependent packages
  50. run: |
  51. 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
  52. - name: build dependent packages
  53. run: |
  54. yarn lerna run build --scope @growi/preset-themes
  55. - name: lerna run lint for app
  56. run: |
  57. yarn lerna run lint --scope @growi/app
  58. - name: Slack Notification
  59. uses: weseek/ghaction-slack-notification@master
  60. if: failure()
  61. with:
  62. type: ${{ job.status }}
  63. job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  64. channel: '#ci'
  65. isCompactMode: true
  66. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  67. test:
  68. runs-on: ubuntu-latest
  69. if: startsWith(github.ref, 'refs/heads/support/prepare-v')
  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-*
  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-directive/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. if: startsWith(github.ref, 'refs/heads/support/prepare-v')
  126. strategy:
  127. matrix:
  128. node-version: [16.x]
  129. services:
  130. mongodb:
  131. image: mongo:4.4
  132. ports:
  133. - 27017/tcp
  134. steps:
  135. - uses: actions/checkout@v3
  136. - uses: actions/setup-node@v3
  137. with:
  138. node-version: ${{ matrix.node-version }}
  139. cache: 'yarn'
  140. cache-dependency-path: '**/yarn.lock'
  141. - name: Cache/Restore node_modules and next cache files
  142. id: cache-dependencies
  143. uses: actions/cache@v3
  144. with:
  145. path: |
  146. **/node_modules
  147. ${{ github.workspace }}/packages/app/.next/cache
  148. key: dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  149. restore-keys: |
  150. dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  151. dev-${{ runner.OS }}-node${{ matrix.node-version }}-
  152. - name: lerna bootstrap
  153. run: |
  154. npx lerna bootstrap -- --frozen-lockfile
  155. - name: yarn dev:ci
  156. working-directory: ./packages/app
  157. run: |
  158. cp config/ci/.env.local.for-ci .env.development.local
  159. yarn dev:ci
  160. env:
  161. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  162. - name: Slack Notification
  163. uses: weseek/ghaction-slack-notification@master
  164. if: failure()
  165. with:
  166. type: ${{ job.status }}
  167. job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  168. channel: '#ci'
  169. isCompactMode: true
  170. url: ${{ secrets.SLACK_WEBHOOK_URL }}