ci-app.yml 7.2 KB

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