ci-app.yml 6.9 KB

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