ci-app.yml 7.1 KB

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