ci-slackbot-proxy.yml 5.6 KB

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