ci-slackbot-proxy.yml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. name: Node CI for slackbot-proxy
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - rc/**
  7. - support/prepare-v**
  8. paths:
  9. - .github/mergify.yml
  10. - .github/workflows/ci-slackbot-proxy.yml
  11. - biome.json
  12. - tsconfig.base.json
  13. - turbo.json
  14. - pnpm-lock.yaml
  15. - package.json
  16. - apps/slackbot-proxy/**
  17. - '!apps/slackbot-proxy/docker/**'
  18. - packages/slack/**
  19. concurrency:
  20. group: ${{ github.workflow }}-${{ github.ref }}
  21. cancel-in-progress: true
  22. jobs:
  23. ci-slackbot-proxy-lint:
  24. runs-on: ubuntu-latest
  25. strategy:
  26. matrix:
  27. node-version: [20.x]
  28. steps:
  29. - uses: actions/checkout@v4
  30. - uses: pnpm/action-setup@v4
  31. - uses: actions/setup-node@v4
  32. with:
  33. node-version: ${{ matrix.node-version }}
  34. cache: 'pnpm'
  35. - name: Restore dist
  36. uses: actions/cache/restore@v4
  37. with:
  38. path: |
  39. **/.turbo
  40. **/dist
  41. key: dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  42. restore-keys: |
  43. dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-
  44. - name: Install dependencies
  45. run: |
  46. pnpm add turbo --global
  47. pnpm install --frozen-lockfile
  48. - name: Lint
  49. run: |
  50. turbo run lint --filter=@growi/slackbot-proxy --filter=@growi/slack
  51. - name: Slack Notification
  52. uses: weseek/ghaction-slack-notification@master
  53. if: failure()
  54. with:
  55. type: ${{ job.status }}
  56. job_name: '*Node CI for growi-bot-proxy - test (${{ matrix.node-version }})*'
  57. channel: '#ci'
  58. isCompactMode: true
  59. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  60. - name: Cache dist
  61. uses: actions/cache/save@v4
  62. with:
  63. path: |
  64. **/.turbo
  65. **/dist
  66. key: dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  67. ci-slackbot-proxy-launch-dev:
  68. runs-on: ubuntu-latest
  69. strategy:
  70. matrix:
  71. node-version: [20.x]
  72. services:
  73. mysql:
  74. image: mysql:8.0
  75. ports:
  76. - 3306
  77. options: --health-cmd "mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 3
  78. env:
  79. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  80. MYSQL_DATABASE: growi-slackbot-proxy
  81. steps:
  82. - uses: actions/checkout@v4
  83. - uses: pnpm/action-setup@v4
  84. - uses: actions/setup-node@v4
  85. with:
  86. node-version: ${{ matrix.node-version }}
  87. cache: 'pnpm'
  88. - name: Restore dist
  89. uses: actions/cache/restore@v4
  90. with:
  91. path: |
  92. **/.turbo
  93. **/dist
  94. key: dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  95. restore-keys: |
  96. dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-
  97. - name: Install dependencies
  98. run: |
  99. pnpm add turbo --global
  100. pnpm install --frozen-lockfile
  101. - name: turbo run dev:ci
  102. working-directory: ./apps/slackbot-proxy
  103. run: |
  104. cp config/ci/.env.local.for-ci .env.development.local
  105. turbo run dev:ci --env-mode=loose
  106. env:
  107. SERVER_URI: http://localhost:8080
  108. TYPEORM_CONNECTION: mysql
  109. TYPEORM_HOST: localhost
  110. TYPEORM_PORT: ${{ job.services.mysql.ports[3306] }}
  111. TYPEORM_DATABASE: growi-slackbot-proxy
  112. TYPEORM_USERNAME: root
  113. TYPEORM_PASSWORD:
  114. - name: Slack Notification
  115. uses: weseek/ghaction-slack-notification@master
  116. if: failure()
  117. with:
  118. type: ${{ job.status }}
  119. job_name: '*Node CI for growi-bot-proxy - launch-dev (${{ matrix.node-version }})*'
  120. channel: '#ci'
  121. isCompactMode: true
  122. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  123. - name: Cache dist
  124. uses: actions/cache/save@v4
  125. with:
  126. path: |
  127. **/.turbo
  128. **/dist
  129. key: dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  130. ci-slackbot-proxy-launch-prod:
  131. if: startsWith(github.head_ref, 'mergify/merge-queue/')
  132. runs-on: ubuntu-latest
  133. strategy:
  134. matrix:
  135. node-version: [20.x]
  136. services:
  137. mysql:
  138. image: mysql:8.0
  139. ports:
  140. - 3306
  141. options: --health-cmd "mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 3
  142. env:
  143. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  144. MYSQL_DATABASE: growi-slackbot-proxy
  145. steps:
  146. - uses: actions/checkout@v4
  147. - uses: pnpm/action-setup@v4
  148. - uses: actions/setup-node@v4
  149. with:
  150. node-version: ${{ matrix.node-version }}
  151. cache: 'pnpm'
  152. - name: Install turbo
  153. run: |
  154. pnpm add turbo --global
  155. - name: Install dependencies
  156. run: |
  157. pnpm install --frozen-lockfile
  158. - name: Restore dist
  159. uses: actions/cache/restore@v4
  160. with:
  161. path: |
  162. **/.turbo
  163. **/dist
  164. key: dist-slackbot-proxy-prod-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  165. restore-keys: |
  166. dist-slackbot-proxy-prod-${{ runner.OS }}-node${{ matrix.node-version }}-
  167. - name: Build
  168. working-directory: ./apps/slackbot-proxy
  169. run: |
  170. turbo run build
  171. - name: Assembling all dependencies
  172. run: |
  173. rm -rf out
  174. pnpm deploy out --prod --filter @growi/slackbot-proxy
  175. rm -rf apps/slackbot-proxy/node_modules && mv out/node_modules apps/slackbot-proxy/node_modules
  176. - name: pnpm run start:prod:ci
  177. working-directory: ./apps/slackbot-proxy
  178. run: |
  179. cp config/ci/.env.local.for-ci .env.production.local
  180. pnpm run start:prod:ci
  181. env:
  182. SERVER_URI: http://localhost:8080
  183. TYPEORM_CONNECTION: mysql
  184. TYPEORM_HOST: localhost
  185. TYPEORM_PORT: ${{ job.services.mysql.ports[3306] }}
  186. TYPEORM_DATABASE: growi-slackbot-proxy
  187. TYPEORM_USERNAME: root
  188. TYPEORM_PASSWORD:
  189. - name: Slack Notification
  190. uses: weseek/ghaction-slack-notification@master
  191. if: failure()
  192. with:
  193. type: ${{ job.status }}
  194. job_name: '*Node CI for growi-bot-proxy - launch-prod (${{ matrix.node-version }})*'
  195. channel: '#ci'
  196. isCompactMode: true
  197. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  198. - name: Cache dist
  199. uses: actions/cache/save@v4
  200. with:
  201. path: |
  202. **/.turbo
  203. **/dist
  204. key: dist-slackbot-proxy-prod-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}