ci-app.yml 6.9 KB

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