ci-slackbot-proxy.yml 5.3 KB

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