ci-slackbot-proxy.yml 7.8 KB

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