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