ci-app.yml 7.3 KB

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