ci-app.yml 5.5 KB

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