ci-slackbot-proxy.yml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. - .eslint*
  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 add node-gyp --global
  48. pnpm install --frozen-lockfile
  49. - name: Lint
  50. run: |
  51. turbo run lint --filter=@growi/slackbot-proxy
  52. - name: Slack Notification
  53. uses: weseek/ghaction-slack-notification@master
  54. if: failure()
  55. with:
  56. type: ${{ job.status }}
  57. job_name: '*Node CI for growi-bot-proxy - test (${{ matrix.node-version }})*'
  58. channel: '#ci'
  59. isCompactMode: true
  60. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  61. - name: Cache dist
  62. uses: actions/cache/save@v4
  63. with:
  64. path: |
  65. **/.turbo
  66. **/dist
  67. key: dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  68. ci-slackbot-proxy-launch-dev:
  69. runs-on: ubuntu-latest
  70. strategy:
  71. matrix:
  72. node-version: [20.x]
  73. services:
  74. mysql:
  75. image: mysql:8.0
  76. ports:
  77. - 3306
  78. options: --health-cmd "mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 3
  79. env:
  80. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  81. MYSQL_DATABASE: growi-slackbot-proxy
  82. steps:
  83. - uses: actions/checkout@v4
  84. - uses: pnpm/action-setup@v4
  85. - uses: actions/setup-node@v4
  86. with:
  87. node-version: ${{ matrix.node-version }}
  88. cache: 'pnpm'
  89. - name: Restore dist
  90. uses: actions/cache/restore@v4
  91. with:
  92. path: |
  93. **/.turbo
  94. **/dist
  95. key: dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  96. restore-keys: |
  97. dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-
  98. - name: Install dependencies
  99. run: |
  100. pnpm add turbo --global
  101. pnpm add node-gyp --global
  102. pnpm install --frozen-lockfile
  103. - name: turbo run dev:ci
  104. working-directory: ./apps/slackbot-proxy
  105. run: |
  106. cp config/ci/.env.local.for-ci .env.development.local
  107. turbo run dev:ci --env-mode=loose
  108. env:
  109. SERVER_URI: http://localhost:8080
  110. TYPEORM_CONNECTION: mysql
  111. TYPEORM_HOST: localhost
  112. TYPEORM_PORT: ${{ job.services.mysql.ports[3306] }}
  113. TYPEORM_DATABASE: growi-slackbot-proxy
  114. TYPEORM_USERNAME: root
  115. TYPEORM_PASSWORD:
  116. - name: Slack Notification
  117. uses: weseek/ghaction-slack-notification@master
  118. if: failure()
  119. with:
  120. type: ${{ job.status }}
  121. job_name: '*Node CI for growi-bot-proxy - launch-dev (${{ matrix.node-version }})*'
  122. channel: '#ci'
  123. isCompactMode: true
  124. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  125. - name: Cache dist
  126. uses: actions/cache/save@v4
  127. with:
  128. path: |
  129. **/.turbo
  130. **/dist
  131. key: dist-slackbot-proxy-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  132. ci-slackbot-proxy-launch-prod:
  133. if: startsWith(github.head_ref, 'mergify/merge-queue/')
  134. runs-on: ubuntu-latest
  135. strategy:
  136. matrix:
  137. node-version: [20.x]
  138. services:
  139. mysql:
  140. image: mysql:8.0
  141. ports:
  142. - 3306
  143. options: --health-cmd "mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 3
  144. env:
  145. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  146. MYSQL_DATABASE: growi-slackbot-proxy
  147. steps:
  148. - uses: actions/checkout@v4
  149. - uses: pnpm/action-setup@v4
  150. - uses: actions/setup-node@v4
  151. with:
  152. node-version: ${{ matrix.node-version }}
  153. cache: 'pnpm'
  154. - name: Install turbo
  155. run: |
  156. pnpm add turbo --global
  157. - name: Prune repositories
  158. run: |
  159. turbo prune @growi/slackbot-proxy
  160. rm -rf apps packages
  161. mv out/* .
  162. - name: Install dependencies
  163. run: |
  164. pnpm add node-gyp --global
  165. pnpm install --frozen-lockfile
  166. - name: Restore dist
  167. uses: actions/cache/restore@v4
  168. with:
  169. path: |
  170. **/.turbo
  171. **/dist
  172. key: dist-slackbot-proxy-prod-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
  173. restore-keys: |
  174. dist-slackbot-proxy-prod-${{ runner.OS }}-node${{ matrix.node-version }}-
  175. - name: Build
  176. working-directory: ./apps/slackbot-proxy
  177. run: |
  178. turbo run build
  179. - name: Install dependencies for production
  180. run: |
  181. pnpm install --prod
  182. - name: pnpm run start:prod:ci
  183. working-directory: ./apps/slackbot-proxy
  184. run: |
  185. cp config/ci/.env.local.for-ci .env.production.local
  186. pnpm run start:prod:ci
  187. env:
  188. SERVER_URI: http://localhost:8080
  189. TYPEORM_CONNECTION: mysql
  190. TYPEORM_HOST: localhost
  191. TYPEORM_PORT: ${{ job.services.mysql.ports[3306] }}
  192. TYPEORM_DATABASE: growi-slackbot-proxy
  193. TYPEORM_USERNAME: root
  194. TYPEORM_PASSWORD:
  195. - name: Slack Notification
  196. uses: weseek/ghaction-slack-notification@master
  197. if: failure()
  198. with:
  199. type: ${{ job.status }}
  200. job_name: '*Node CI for growi-bot-proxy - launch-prod (${{ matrix.node-version }})*'
  201. channel: '#ci'
  202. isCompactMode: true
  203. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  204. - name: Cache dist
  205. uses: actions/cache/save@v4
  206. with:
  207. path: |
  208. **/.turbo
  209. **/dist
  210. key: dist-slackbot-proxy-prod-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}