ci-slackbot-proxy.yml 7.0 KB

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