ci-app.yml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. - turbo.json
  12. - yarn.lock
  13. - apps/app/**
  14. - '!apps/app/docker/**'
  15. - packages/codemirror-textlint/**
  16. - packages/core/**
  17. - packages/hackmd/**
  18. - packages/presentation/**
  19. - packages/preset-themes/**
  20. - packages/remark-*/**
  21. - packages/slack/**
  22. - packages/ui/**
  23. concurrency:
  24. group: ${{ github.workflow }}-${{ github.ref }}
  25. cancel-in-progress: true
  26. jobs:
  27. lint:
  28. runs-on: ubuntu-latest
  29. strategy:
  30. matrix:
  31. node-version: [18.x]
  32. steps:
  33. - uses: actions/checkout@v3
  34. - uses: actions/setup-node@v3
  35. with:
  36. node-version: ${{ matrix.node-version }}
  37. cache: 'yarn'
  38. cache-dependency-path: '**/yarn.lock'
  39. - name: Cache/Restore node_modules
  40. uses: actions/cache@v3
  41. with:
  42. path: |
  43. **/node_modules
  44. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/app/package.json') }}
  45. restore-keys: |
  46. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  47. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  48. - name: Restore dist
  49. uses: actions/cache/restore@v3
  50. with:
  51. path: |
  52. **/.turbo
  53. **/dist
  54. key: dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  55. restore-keys: |
  56. dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-
  57. - name: Install dependencies
  58. run: |
  59. yarn global add turbo
  60. yarn --frozen-lockfile
  61. - name: Lint
  62. run: |
  63. turbo run lint --filter=!@growi/slackbot-proxy
  64. - name: Slack Notification
  65. uses: weseek/ghaction-slack-notification@master
  66. if: failure()
  67. with:
  68. type: ${{ job.status }}
  69. job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  70. channel: '#ci'
  71. isCompactMode: true
  72. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  73. - name: Cache dist
  74. uses: actions/cache/save@v3
  75. with:
  76. path: |
  77. **/.turbo
  78. **/dist
  79. key: dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  80. test:
  81. runs-on: ubuntu-latest
  82. strategy:
  83. matrix:
  84. node-version: [18.x]
  85. services:
  86. mongodb:
  87. image: mongo:4.4
  88. ports:
  89. - 27017/tcp
  90. steps:
  91. - uses: actions/checkout@v3
  92. - uses: actions/setup-node@v3
  93. with:
  94. node-version: ${{ matrix.node-version }}
  95. cache: 'yarn'
  96. cache-dependency-path: '**/yarn.lock'
  97. - name: Cache/Restore node_modules
  98. id: cache-dependencies
  99. uses: actions/cache@v3
  100. with:
  101. path: |
  102. **/node_modules
  103. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/app/package.json') }}
  104. restore-keys: |
  105. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  106. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  107. - name: Restore dist
  108. uses: actions/cache/restore@v3
  109. with:
  110. path: |
  111. **/.turbo
  112. **/dist
  113. key: dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  114. restore-keys: |
  115. dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-
  116. - name: Install dependencies
  117. run: |
  118. yarn global add turbo
  119. yarn --frozen-lockfile
  120. - name: Test
  121. run: |
  122. turbo run test --filter=!@growi/slackbot-proxy
  123. env:
  124. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  125. - name: Upload coverage report as artifact
  126. uses: actions/upload-artifact@v3
  127. with:
  128. name: Coverage Report
  129. path: |
  130. apps/app/coverage
  131. packages/remark-growi-directive/coverage
  132. - name: Slack Notification
  133. uses: weseek/ghaction-slack-notification@master
  134. if: failure()
  135. with:
  136. type: ${{ job.status }}
  137. job_name: '*Node CI for growi - test (${{ matrix.node-version }})*'
  138. channel: '#ci'
  139. isCompactMode: true
  140. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  141. - name: Cache dist
  142. uses: actions/cache/save@v3
  143. with:
  144. path: |
  145. **/.turbo
  146. **/dist
  147. key: dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  148. launch-dev:
  149. runs-on: ubuntu-latest
  150. strategy:
  151. matrix:
  152. node-version: [18.x]
  153. services:
  154. mongodb:
  155. image: mongo:4.4
  156. ports:
  157. - 27017/tcp
  158. steps:
  159. - uses: actions/checkout@v3
  160. - uses: actions/setup-node@v3
  161. with:
  162. node-version: ${{ matrix.node-version }}
  163. cache: 'yarn'
  164. cache-dependency-path: '**/yarn.lock'
  165. - name: Cache/Restore node_modules
  166. id: cache-dependencies
  167. uses: actions/cache@v3
  168. with:
  169. path: |
  170. **/node_modules
  171. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/app/package.json') }}
  172. restore-keys: |
  173. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  174. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  175. - name: Restore dist
  176. uses: actions/cache/restore@v3
  177. with:
  178. path: |
  179. **/.turbo
  180. **/dist
  181. ${{ github.workspace }}/apps/app/.next
  182. key: dist-app-dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  183. restore-keys: |
  184. dist-app-dev-${{ runner.OS }}-node${{ matrix.node-version }}-
  185. - name: Install dependencies
  186. run: |
  187. yarn global add turbo
  188. yarn --frozen-lockfile
  189. - name: turbo run dev:ci
  190. working-directory: ./apps/app
  191. run: |
  192. cp config/ci/.env.local.for-ci .env.development.local
  193. turbo run dev:ci
  194. env:
  195. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  196. - name: Slack Notification
  197. uses: weseek/ghaction-slack-notification@master
  198. if: failure()
  199. with:
  200. type: ${{ job.status }}
  201. job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  202. channel: '#ci'
  203. isCompactMode: true
  204. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  205. - name: Cache dist
  206. uses: actions/cache/save@v3
  207. with:
  208. path: |
  209. **/.turbo
  210. **/dist
  211. ${{ github.workspace }}/apps/app/.next
  212. key: dist-app-dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}