ci-slackbot-proxy.yml 8.0 KB

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