ci-app.yml 6.9 KB

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