ci-app.yml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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/preset-themes/**
  17. - packages/presentation/**
  18. - packages/remark-*/**
  19. - packages/slack/**
  20. - packages/ui/**
  21. concurrency:
  22. group: ${{ github.workflow }}-${{ github.ref }}
  23. cancel-in-progress: true
  24. jobs:
  25. lint:
  26. runs-on: ubuntu-latest
  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. 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. strategy:
  126. matrix:
  127. node-version: [16.x]
  128. services:
  129. mongodb:
  130. image: mongo:4.4
  131. ports:
  132. - 27017/tcp
  133. steps:
  134. - uses: actions/checkout@v3
  135. - uses: actions/setup-node@v3
  136. with:
  137. node-version: ${{ matrix.node-version }}
  138. cache: 'yarn'
  139. cache-dependency-path: '**/yarn.lock'
  140. - name: Cache/Restore node_modules and next cache files
  141. id: cache-dependencies
  142. uses: actions/cache@v3
  143. with:
  144. path: |
  145. **/node_modules
  146. ${{ github.workspace }}/packages/app/.next/cache
  147. key: dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  148. restore-keys: |
  149. dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  150. dev-${{ runner.OS }}-node${{ matrix.node-version }}-
  151. - name: lerna bootstrap
  152. run: |
  153. npx lerna bootstrap -- --frozen-lockfile
  154. - name: yarn dev:ci
  155. working-directory: ./packages/app
  156. run: |
  157. cp config/ci/.env.local.for-ci .env.development.local
  158. yarn dev:ci
  159. env:
  160. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  161. - name: Slack Notification
  162. uses: weseek/ghaction-slack-notification@master
  163. if: failure()
  164. with:
  165. type: ${{ job.status }}
  166. job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  167. channel: '#ci'
  168. isCompactMode: true
  169. url: ${{ secrets.SLACK_WEBHOOK_URL }}