ci-app.yml 6.1 KB

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