ci-app.yml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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/turbo
  39. key: node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
  40. restore-keys: |
  41. node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-
  42. node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
  43. - name: Cache/Restore dist
  44. uses: actions/cache@v4
  45. with:
  46. path: |
  47. **/.turbo
  48. **/dist
  49. **/node_modules/.cache/turbo
  50. key: dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
  51. restore-keys: |
  52. dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-
  53. dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
  54. - name: Install dependencies
  55. run: |
  56. yarn global add turbo
  57. yarn global add node-gyp
  58. yarn --frozen-lockfile
  59. - name: Lint
  60. run: |
  61. turbo run lint --filter=!@growi/slackbot-proxy
  62. - name: Slack Notification
  63. uses: weseek/ghaction-slack-notification@master
  64. if: failure()
  65. with:
  66. type: ${{ job.status }}
  67. job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  68. channel: '#ci'
  69. isCompactMode: true
  70. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  71. ci-app-test:
  72. runs-on: ubuntu-latest
  73. strategy:
  74. matrix:
  75. node-version: [20.x]
  76. services:
  77. mongodb:
  78. image: mongo:6.0
  79. ports:
  80. - 27017/tcp
  81. steps:
  82. - uses: actions/checkout@v4
  83. - uses: actions/setup-node@v4
  84. with:
  85. node-version: ${{ matrix.node-version }}
  86. cache: 'yarn'
  87. cache-dependency-path: '**/yarn.lock'
  88. - name: Cache/Restore node_modules
  89. uses: actions/cache@v4
  90. with:
  91. path: |
  92. **/node_modules
  93. !**/node_modules/.cache/turbo
  94. key: node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
  95. restore-keys: |
  96. node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-
  97. node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
  98. - name: Cache/Restore dist
  99. uses: actions/cache@v4
  100. with:
  101. path: |
  102. **/.turbo
  103. **/dist
  104. **/node_modules/.cache/turbo
  105. key: dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
  106. restore-keys: |
  107. dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-
  108. dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
  109. - name: Install dependencies
  110. run: |
  111. yarn global add turbo
  112. yarn global add node-gyp
  113. yarn --frozen-lockfile
  114. - name: Test
  115. run: |
  116. turbo run test --filter=!@growi/slackbot-proxy --env-mode=loose
  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@v4
  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. ci-app-launch-dev:
  136. runs-on: ubuntu-latest
  137. strategy:
  138. matrix:
  139. node-version: [20.x]
  140. services:
  141. mongodb:
  142. image: mongo:6.0
  143. ports:
  144. - 27017/tcp
  145. steps:
  146. - uses: actions/checkout@v4
  147. - uses: actions/setup-node@v4
  148. with:
  149. node-version: ${{ matrix.node-version }}
  150. cache: 'yarn'
  151. cache-dependency-path: '**/yarn.lock'
  152. - name: Cache/Restore node_modules
  153. uses: actions/cache@v4
  154. with:
  155. path: |
  156. **/node_modules
  157. !**/node_modules/.cache/turbo
  158. key: node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
  159. restore-keys: |
  160. node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-
  161. node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
  162. - name: Cache/Restore dist
  163. uses: actions/cache@v4
  164. with:
  165. path: |
  166. **/.turbo
  167. **/dist
  168. **/node_modules/.cache/turbo
  169. key: dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
  170. restore-keys: |
  171. dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.head_ref || github.ref_name }}-
  172. dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
  173. - name: Install dependencies
  174. run: |
  175. yarn global add turbo
  176. yarn global add node-gyp
  177. yarn --frozen-lockfile
  178. - name: turbo run dev:ci
  179. working-directory: ./apps/app
  180. run: |
  181. cp config/ci/.env.local.for-ci .env.development.local
  182. turbo run dev:ci --env-mode=loose
  183. env:
  184. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  185. - name: Slack Notification
  186. uses: weseek/ghaction-slack-notification@master
  187. if: failure()
  188. with:
  189. type: ${{ job.status }}
  190. job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  191. channel: '#ci'
  192. isCompactMode: true
  193. url: ${{ secrets.SLACK_WEBHOOK_URL }}