ci-slackbot-proxy.yml 7.0 KB

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