ci-slackbot-proxy.yml 4.9 KB

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