ci-app.yml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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/remark-*/**
  18. - packages/slack/**
  19. - packages/ui/**
  20. concurrency:
  21. group: ${{ github.workflow }}-${{ github.ref }}
  22. cancel-in-progress: true
  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 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. strategy:
  70. matrix:
  71. node-version: [16.x]
  72. services:
  73. mongodb:
  74. image: mongo:4.4
  75. ports:
  76. - 27017/tcp
  77. steps:
  78. - uses: actions/checkout@v3
  79. - uses: actions/setup-node@v3
  80. with:
  81. node-version: ${{ matrix.node-version }}
  82. cache: 'yarn'
  83. cache-dependency-path: '**/yarn.lock'
  84. - name: Cache/Restore node_modules
  85. id: cache-dependencies
  86. uses: actions/cache@v3
  87. with:
  88. path: |
  89. **/node_modules
  90. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  91. restore-keys: |
  92. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  93. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  94. - name: lerna bootstrap
  95. run: |
  96. npx lerna bootstrap -- --frozen-lockfile
  97. - name: lerna run test for plugins
  98. run: |
  99. yarn lerna run test --scope @growi/remark-*
  100. - name: Test app
  101. working-directory: ./packages/app
  102. run: |
  103. yarn test:ci --selectProjects unit server ; yarn test:ci --selectProjects server-v5
  104. env:
  105. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  106. - name: Upload coverage report as artifact
  107. uses: actions/upload-artifact@v3
  108. with:
  109. name: Coverage Report
  110. path: |
  111. packages/app/coverage
  112. packages/remark-growi-directive/coverage
  113. - name: Slack Notification
  114. uses: weseek/ghaction-slack-notification@master
  115. if: failure()
  116. with:
  117. type: ${{ job.status }}
  118. job_name: '*Node CI for growi - test (${{ matrix.node-version }})*'
  119. channel: '#ci'
  120. isCompactMode: true
  121. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  122. launch-dev:
  123. runs-on: ubuntu-latest
  124. strategy:
  125. matrix:
  126. node-version: [16.x]
  127. services:
  128. mongodb:
  129. image: mongo:4.4
  130. ports:
  131. - 27017/tcp
  132. steps:
  133. - uses: actions/checkout@v3
  134. - uses: actions/setup-node@v3
  135. with:
  136. node-version: ${{ matrix.node-version }}
  137. cache: 'yarn'
  138. cache-dependency-path: '**/yarn.lock'
  139. - name: Cache/Restore node_modules and next cache files
  140. id: cache-dependencies
  141. uses: actions/cache@v3
  142. with:
  143. path: |
  144. **/node_modules
  145. ${{ github.workspace }}/packages/app/.next/cache
  146. key: dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  147. restore-keys: |
  148. dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  149. dev-${{ runner.OS }}-node${{ matrix.node-version }}-
  150. - name: lerna bootstrap
  151. run: |
  152. npx lerna bootstrap -- --frozen-lockfile
  153. - name: yarn dev:ci
  154. working-directory: ./packages/app
  155. run: |
  156. cp config/ci/.env.local.for-ci .env.development.local
  157. yarn dev:ci
  158. env:
  159. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  160. - name: Slack Notification
  161. uses: weseek/ghaction-slack-notification@master
  162. if: failure()
  163. with:
  164. type: ${{ job.status }}
  165. job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  166. channel: '#ci'
  167. isCompactMode: true
  168. url: ${{ secrets.SLACK_WEBHOOK_URL }}