ci-slackbot-proxy.yml 5.5 KB

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