ci-app.yml 5.8 KB

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