ci-slackbot-proxy.yml 8.1 KB

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