ci-slackbot-proxy.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. SERVER_URI: http://localhost:8080
  81. TYPEORM_CONNECTION: mysql
  82. TYPEORM_HOST: localhost
  83. TYPEORM_PORT: ${{ job.services.mysql.ports[3306] }}
  84. TYPEORM_DATABASE: growi-slackbot-proxy
  85. TYPEORM_USERNAME: root
  86. TYPEORM_PASSWORD:
  87. - name: Slack Notification
  88. uses: weseek/ghaction-slack-notification@master
  89. if: failure()
  90. with:
  91. type: ${{ job.status }}
  92. job_name: '*Node CI for growi-bot-proxy - launch-dev (${{ matrix.node-version }})*'
  93. channel: '#ci'
  94. isCompactMode: true
  95. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  96. launch-prod:
  97. runs-on: ubuntu-latest
  98. strategy:
  99. matrix:
  100. node-version: [14.x]
  101. services:
  102. mysql:
  103. image: mysql:8.0
  104. ports:
  105. - 3306
  106. options: --health-cmd "mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 3
  107. env:
  108. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  109. MYSQL_DATABASE: growi-slackbot-proxy
  110. steps:
  111. - uses: actions/checkout@v2
  112. - uses: actions/setup-node@v2
  113. with:
  114. node-version: ${{ matrix.node-version }}
  115. cache: 'yarn'
  116. cache-dependency-path: '**/yarn.lock'
  117. - name: Remove unnecessary packages
  118. working-directory: ./packages
  119. run: |
  120. ls | egrep -v '^(slack|slackbot-proxy)$' | xargs rm -r
  121. - name: lerna bootstrap
  122. run: |
  123. npx lerna bootstrap
  124. - name: Print dependencies
  125. run: |
  126. echo -n "node " && node -v
  127. echo -n "npm " && npm -v
  128. yarn list --depth=0
  129. - name: lerna run build
  130. run: |
  131. yarn lerna run build
  132. - name: lerna bootstrap --production
  133. run: |
  134. npx lerna bootstrap -- --production
  135. - name: Print dependencies
  136. run: |
  137. echo -n "node " && node -v
  138. echo -n "npm " && npm -v
  139. yarn list --production --depth=0
  140. - name: yarn start:prod:ci
  141. working-directory: ./packages/slackbot-proxy
  142. run: |
  143. cp config/ci/.env.local.for-ci .env.production.local
  144. yarn start:prod:ci
  145. env:
  146. SERVER_URI: http://localhost:8080
  147. TYPEORM_CONNECTION: mysql
  148. TYPEORM_HOST: localhost
  149. TYPEORM_PORT: ${{ job.services.mysql.ports[3306] }}
  150. TYPEORM_DATABASE: growi-slackbot-proxy
  151. TYPEORM_USERNAME: root
  152. TYPEORM_PASSWORD:
  153. - name: Slack Notification
  154. uses: weseek/ghaction-slack-notification@master
  155. if: failure()
  156. with:
  157. type: ${{ job.status }}
  158. job_name: '*Node CI for growi-bot-proxy - launch-prod (${{ matrix.node-version }})*'
  159. channel: '#ci'
  160. isCompactMode: true
  161. url: ${{ secrets.SLACK_WEBHOOK_URL }}