ci-app.yml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. name: Node CI for app development
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - rc/**
  7. - changeset-release/**
  8. - mergify/merge-queue/**
  9. - tmp-mergify/merge-queue/**
  10. paths:
  11. - .github/mergify.yml
  12. - .github/workflows/ci-app.yml
  13. - biome.json
  14. - tsconfig.base.json
  15. - turbo.json
  16. - pnpm-lock.yaml
  17. - package.json
  18. - apps/app/**
  19. - '!apps/app/docker/**'
  20. - packages/**
  21. pull_request:
  22. types: [opened, reopened, synchronize]
  23. paths:
  24. - .github/mergify.yml
  25. - .github/workflows/ci-app.yml
  26. - biome.json
  27. - tsconfig.base.json
  28. - turbo.json
  29. - pnpm-lock.yaml
  30. - package.json
  31. - apps/app/**
  32. - '!apps/app/docker/**'
  33. - packages/**
  34. concurrency:
  35. group: ${{ github.workflow }}-${{ github.ref }}
  36. cancel-in-progress: true
  37. jobs:
  38. ci-app-lint:
  39. runs-on: ubuntu-latest
  40. strategy:
  41. matrix:
  42. node-version: [24.x]
  43. steps:
  44. - uses: actions/checkout@v6
  45. - uses: pnpm/action-setup@v6
  46. - uses: actions/setup-node@v6
  47. with:
  48. node-version: ${{ matrix.node-version }}
  49. cache: 'pnpm'
  50. - name: Cache/Restore dist
  51. uses: actions/cache@v4
  52. with:
  53. path: |
  54. **/.turbo
  55. **/dist
  56. **/node_modules/.cache/turbo
  57. key: dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.sha }}
  58. restore-keys: |
  59. dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
  60. - name: Install dependencies
  61. run: |
  62. pnpm add turbo --global
  63. pnpm install --frozen-lockfile
  64. - name: Lint
  65. run: |
  66. turbo run lint --filter=@growi/app --filter=./packages/*
  67. - name: Slack Notification
  68. uses: weseek/ghaction-slack-notification@master
  69. if: failure()
  70. with:
  71. type: ${{ job.status }}
  72. job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  73. channel: '#ci'
  74. isCompactMode: true
  75. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  76. ci-app-test:
  77. runs-on: ubuntu-latest
  78. strategy:
  79. matrix:
  80. node-version: [24.x]
  81. mongodb-version: ['6.0', '8.0']
  82. services:
  83. mongodb:
  84. image: mongo:${{ matrix.mongodb-version }}
  85. ports:
  86. - 27017/tcp
  87. steps:
  88. - uses: actions/checkout@v6
  89. - uses: pnpm/action-setup@v6
  90. - &setup-node-step
  91. uses: actions/setup-node@v6
  92. with:
  93. node-version: ${{ matrix.node-version }}
  94. cache: 'pnpm'
  95. - &cache-restore-dist-step
  96. name: Cache/Restore dist
  97. uses: actions/cache@v4
  98. with:
  99. path: |
  100. **/.turbo
  101. **/dist
  102. **/node_modules/.cache/turbo
  103. key: dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.sha }}
  104. restore-keys: |
  105. dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
  106. - &install-dependencies-step
  107. name: Install dependencies
  108. run: |
  109. pnpm add turbo --global
  110. pnpm install --frozen-lockfile
  111. - name: Test
  112. run: |
  113. turbo run test --filter=@growi/app --filter=./packages/* --env-mode=loose
  114. env:
  115. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  116. - name: Upload coverage report as artifact
  117. uses: actions/upload-artifact@v7
  118. with:
  119. name: coverage-mongo${{ matrix.mongodb-version }}
  120. path: |
  121. apps/app/coverage
  122. packages/remark-growi-directive/coverage
  123. - name: Slack Notification
  124. uses: weseek/ghaction-slack-notification@master
  125. if: failure()
  126. with:
  127. type: ${{ job.status }}
  128. job_name: '*Node CI for growi - test (${{ matrix.node-version }})*'
  129. channel: '#ci'
  130. isCompactMode: true
  131. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  132. ci-app-test-integration:
  133. runs-on: ubuntu-latest
  134. strategy:
  135. matrix:
  136. node-version: [24.x]
  137. mongodb-version: ['8.0']
  138. elasticsearch-version:
  139. - env: 8
  140. stack-version: '8.19.16'
  141. - env: 9
  142. stack-version: '9.3.3'
  143. # [MEMO] Elasticsearch is started in a step to install plugins before starting it.
  144. services:
  145. mongodb:
  146. image: mongo:${{ matrix.mongodb-version }}
  147. ports:
  148. - 27017/tcp
  149. steps:
  150. - uses: actions/checkout@v6
  151. - uses: pnpm/action-setup@v6
  152. - *setup-node-step
  153. - *cache-restore-dist-step
  154. - *install-dependencies-step
  155. - name: Start Elasticsearch with plugins
  156. uses: elastic/elastic-github-actions/elasticsearch@master
  157. with:
  158. stack-version: ${{ matrix.elasticsearch-version.stack-version }}
  159. plugins: |
  160. analysis-kuromoji
  161. analysis-icu
  162. security-enabled: false
  163. - name: Wait for Elasticsearch to be ready
  164. run: |
  165. curl \
  166. --no-progress-meter \
  167. -X GET \
  168. --retry 60 \
  169. --retry-delay 1 \
  170. --retry-connrefused \
  171. http://localhost:9200/_cluster/health?wait_for_status=green
  172. - name: Test
  173. run: |
  174. turbo run test:integ --filter=@growi/app --env-mode=loose
  175. env:
  176. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  177. VITE_ELASTICSEARCH_URI: http://localhost:9200/growi
  178. VITE_ELASTICSEARCH_VERSION: ${{ matrix.elasticsearch-version.env }}
  179. - name: Upload coverage report as artifact
  180. uses: actions/upload-artifact@v7
  181. with:
  182. name: coverage-es${{ matrix.elasticsearch-version.env }}-mongo${{ matrix.mongodb-version }}
  183. path: |
  184. apps/app/coverage
  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 - test-es (${{ matrix.node-version }})*'
  191. channel: '#ci'
  192. isCompactMode: true
  193. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  194. ci-app-launch-dev:
  195. runs-on: ubuntu-latest
  196. strategy:
  197. matrix:
  198. node-version: [24.x]
  199. mongodb-version: ['6.0', '8.0']
  200. services:
  201. mongodb:
  202. image: mongo:${{ matrix.mongodb-version }}
  203. ports:
  204. - 27017/tcp
  205. steps:
  206. - uses: actions/checkout@v6
  207. - uses: pnpm/action-setup@v6
  208. - uses: actions/setup-node@v6
  209. with:
  210. node-version: ${{ matrix.node-version }}
  211. cache: 'pnpm'
  212. - name: Cache/Restore dist
  213. uses: actions/cache@v4
  214. with:
  215. path: |
  216. **/.turbo
  217. **/dist
  218. **/node_modules/.cache/turbo
  219. key: dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.sha }}
  220. restore-keys: |
  221. dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
  222. - name: Install dependencies
  223. run: |
  224. pnpm add turbo --global
  225. pnpm install --frozen-lockfile
  226. - name: turbo run launch-dev:ci
  227. working-directory: ./apps/app
  228. run: |
  229. cp config/ci/.env.local.for-ci .env.development.local
  230. turbo run launch-dev:ci --env-mode=loose
  231. env:
  232. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  233. - name: Slack Notification
  234. uses: weseek/ghaction-slack-notification@master
  235. if: failure()
  236. with:
  237. type: ${{ job.status }}
  238. job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  239. channel: '#ci'
  240. isCompactMode: true
  241. url: ${{ secrets.SLACK_WEBHOOK_URL }}