ci-app.yml 5.8 KB

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