ci-slackbot-proxy.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. name: Node CI for slackbot-proxy
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - rc/**
  7. - chore/**
  8. - support/prepare-v**
  9. paths:
  10. - .github/workflows/ci-slackbot-proxy.yml
  11. - .eslint*
  12. - tsconfig.base.json
  13. - yarn.lock
  14. - packages/slackbot-proxy/**
  15. - '!packages/slackbot-proxy/docker/**'
  16. - packages/slack/**
  17. concurrency:
  18. group: ${{ github.workflow }}-${{ github.ref }}
  19. cancel-in-progress: true
  20. jobs:
  21. test:
  22. runs-on: ubuntu-latest
  23. strategy:
  24. matrix:
  25. node-version: [16.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. id: cache-dependencies
  35. uses: actions/cache@v3
  36. with:
  37. path: |
  38. **/node_modules
  39. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  40. restore-keys: |
  41. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  42. - name: lerna bootstrap
  43. run: |
  44. npx lerna bootstrap -- --frozen-lockfile
  45. - name: yarn lint
  46. run: |
  47. yarn lerna run lint --scope @growi/slack --scope @growi/slackbot-proxy
  48. - name: yarn test
  49. run: |
  50. yarn lerna run test --scope @growi/slack --scope @growi/slackbot-proxy
  51. - name: Slack Notification
  52. uses: weseek/ghaction-slack-notification@master
  53. if: failure()
  54. with:
  55. type: ${{ job.status }}
  56. job_name: '*Node CI for growi-bot-proxy - test (${{ matrix.node-version }})*'
  57. channel: '#ci'
  58. isCompactMode: true
  59. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  60. launch-dev:
  61. runs-on: ubuntu-latest
  62. strategy:
  63. matrix:
  64. node-version: [16.x]
  65. services:
  66. mysql:
  67. image: mysql:8.0
  68. ports:
  69. - 3306
  70. options: --health-cmd "mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 3
  71. env:
  72. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  73. MYSQL_DATABASE: growi-slackbot-proxy
  74. steps:
  75. - uses: actions/checkout@v3
  76. - uses: actions/setup-node@v3
  77. with:
  78. node-version: ${{ matrix.node-version }}
  79. cache: 'yarn'
  80. cache-dependency-path: '**/yarn.lock'
  81. - name: Cache/Restore node_modules
  82. id: cache-dependencies
  83. uses: actions/cache@v3
  84. with:
  85. path: |
  86. **/node_modules
  87. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  88. restore-keys: |
  89. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  90. - name: lerna bootstrap
  91. run: |
  92. npx lerna bootstrap -- --frozen-lockfile
  93. - name: yarn dev:ci
  94. working-directory: ./packages/slackbot-proxy
  95. run: |
  96. cp config/ci/.env.local.for-ci .env.development.local
  97. yarn dev:ci
  98. env:
  99. SERVER_URI: http://localhost:8080
  100. TYPEORM_CONNECTION: mysql
  101. TYPEORM_HOST: localhost
  102. TYPEORM_PORT: ${{ job.services.mysql.ports[3306] }}
  103. TYPEORM_DATABASE: growi-slackbot-proxy
  104. TYPEORM_USERNAME: root
  105. TYPEORM_PASSWORD:
  106. - name: Slack Notification
  107. uses: weseek/ghaction-slack-notification@master
  108. if: failure()
  109. with:
  110. type: ${{ job.status }}
  111. job_name: '*Node CI for growi-bot-proxy - launch-dev (${{ matrix.node-version }})*'
  112. channel: '#ci'
  113. isCompactMode: true
  114. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  115. launch-prod:
  116. runs-on: ubuntu-latest
  117. strategy:
  118. matrix:
  119. node-version: [16.x]
  120. services:
  121. mysql:
  122. image: mysql:8.0
  123. ports:
  124. - 3306
  125. options: --health-cmd "mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 3
  126. env:
  127. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  128. MYSQL_DATABASE: growi-slackbot-proxy
  129. steps:
  130. - uses: actions/checkout@v3
  131. - uses: actions/setup-node@v3
  132. with:
  133. node-version: ${{ matrix.node-version }}
  134. cache: 'yarn'
  135. cache-dependency-path: '**/yarn.lock'
  136. - name: Remove unnecessary packages
  137. working-directory: ./packages
  138. run: |
  139. ls | egrep -v '^(slack|slackbot-proxy)$' | xargs rm -r
  140. - name: lerna bootstrap
  141. run: |
  142. npx lerna bootstrap
  143. - name: Print dependencies
  144. run: |
  145. echo -n "node " && node -v
  146. echo -n "npm " && npm -v
  147. yarn list --depth=0
  148. - name: lerna run build
  149. run: |
  150. yarn lerna run build
  151. - name: lerna bootstrap --production
  152. run: |
  153. npx lerna bootstrap -- --production
  154. - name: Print dependencies
  155. run: |
  156. echo -n "node " && node -v
  157. echo -n "npm " && npm -v
  158. yarn list --production --depth=0
  159. - name: yarn start:prod:ci
  160. working-directory: ./packages/slackbot-proxy
  161. run: |
  162. cp config/ci/.env.local.for-ci .env.production.local
  163. yarn start:prod:ci
  164. env:
  165. SERVER_URI: http://localhost:8080
  166. TYPEORM_CONNECTION: mysql
  167. TYPEORM_HOST: localhost
  168. TYPEORM_PORT: ${{ job.services.mysql.ports[3306] }}
  169. TYPEORM_DATABASE: growi-slackbot-proxy
  170. TYPEORM_USERNAME: root
  171. TYPEORM_PASSWORD:
  172. - name: Slack Notification
  173. uses: weseek/ghaction-slack-notification@master
  174. if: failure()
  175. with:
  176. type: ${{ job.status }}
  177. job_name: '*Node CI for growi-bot-proxy - launch-prod (${{ matrix.node-version }})*'
  178. channel: '#ci'
  179. isCompactMode: true
  180. url: ${{ secrets.SLACK_WEBHOOK_URL }}