ci-bot-proxy.yml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. name: Node CI for growi-bot-proxy
  2. on:
  3. push:
  4. branches-ignore:
  5. - release/**
  6. - tmp/**
  7. paths:
  8. - packages/growi-bot-proxy/*
  9. paths-ignore:
  10. - src
  11. defaults:
  12. run:
  13. working-directory: packages/growi-bot-proxy
  14. jobs:
  15. test:
  16. runs-on: ubuntu-latest
  17. strategy:
  18. matrix:
  19. node-version: [14.x]
  20. steps:
  21. - uses: actions/checkout@v2
  22. - name: Use Node.js ${{ matrix.node-version }}
  23. uses: actions/setup-node@v1
  24. with:
  25. node-version: ${{ matrix.node-version }}
  26. - name: Cache/Restore node_modules
  27. id: cache-dependencies
  28. uses: actions/cache@v2
  29. with:
  30. path: node_modules
  31. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('./yarn.lock') }}
  32. - name: Get yarn cache dir
  33. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  34. id: cache-yarn
  35. run: echo "::set-output name=dir::$(yarn cache dir)"
  36. - name: Cache/Restore yarn cache
  37. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  38. uses: actions/cache@v2
  39. with:
  40. path: ${{ steps.cache-yarn.outputs.dir }}
  41. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('./yarn.lock') }}
  42. restore-keys: |
  43. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  44. - name: Install dependencies
  45. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  46. run: |
  47. yarn
  48. - name: Print dependencies
  49. run: |
  50. echo -n "node " && node -v
  51. echo -n "npm " && npm -v
  52. yarn list --depth=0
  53. - name: yarn lint
  54. run: |
  55. yarn test
  56. - name: Slack Notification
  57. uses: weseek/ghaction-slack-notification@master
  58. if: failure()
  59. with:
  60. type: ${{ job.status }}
  61. job_name: '*Node CI for growi-bot-proxy - test (${{ matrix.node-version }})*'
  62. channel: '#ci'
  63. isCompactMode: true
  64. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  65. launch-dev:
  66. runs-on: ubuntu-latest
  67. strategy:
  68. matrix:
  69. node-version: [14.x]
  70. steps:
  71. - uses: actions/checkout@v2
  72. - name: Use Node.js ${{ matrix.node-version }}
  73. uses: actions/setup-node@v1
  74. with:
  75. node-version: ${{ matrix.node-version }}
  76. - name: Cache/Restore node_modules
  77. id: cache-dependencies
  78. uses: actions/cache@v2
  79. with:
  80. path: node_modules
  81. key: ${{ runner.OS }}-node_modules_dev-${{ matrix.node-version }}-${{ hashFiles('./yarn.lock') }}
  82. - name: Get yarn cache dir
  83. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  84. id: cache-yarn
  85. run: echo "::set-output name=dir::$(yarn cache dir)"
  86. - name: Cache/Restore yarn cache
  87. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  88. uses: actions/cache@v2
  89. with:
  90. path: ${{ steps.cache-yarn.outputs.dir }}
  91. key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
  92. restore-keys: |
  93. ${{ runner.os }}-yarn-
  94. - name: Install dependencies
  95. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  96. run: |
  97. yarn
  98. - name: Print dependencies
  99. run: |
  100. echo -n "node " && node -v
  101. echo -n "npm " && npm -v
  102. yarn list --depth=0
  103. - name: yarn dev:ci
  104. run: |
  105. yarn dev:ci
  106. - name: Slack Notification
  107. uses: weseek/ghaction-slack-notification@master
  108. if: failure()
  109. with:
  110. type: ${{ job.status }}
  111. job_name: '*Node CI for growi-bot-proxy - launch-dev (${{ matrix.node-version }})*'
  112. channel: '#ci'
  113. isCompactMode: true
  114. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  115. launch-prod:
  116. runs-on: ubuntu-latest
  117. strategy:
  118. matrix:
  119. node-version: [14.x]
  120. steps:
  121. - uses: actions/checkout@v2
  122. - name: Use Node.js ${{ matrix.node-version }}
  123. uses: actions/setup-node@v1
  124. with:
  125. node-version: ${{ matrix.node-version }}
  126. - name: Get Date
  127. id: date
  128. run: |
  129. echo ::set-output name=YmdH::$(date '+%Y%m%d%H')
  130. echo ::set-output name=Ymd::$(date '+%Y%m%d')
  131. echo ::set-output name=Ym::$(date '+%Y%m')
  132. echo ::set-output name=Y::$(date '+%Y')
  133. - name: Cache/Restore node_modules
  134. uses: actions/cache@v2
  135. with:
  136. path: node_modules
  137. key: ${{ runner.OS }}-node_modules_prod-${{ matrix.node-version }}-${{ steps.date.outputs.YmdH }}
  138. restore-keys: |
  139. ${{ runner.os }}-node_modules_prod-${{ matrix.node-version }}-${{ steps.date.outputs.Ymd }}
  140. ${{ runner.os }}-node_modules_prod-${{ matrix.node-version }}-${{ steps.date.outputs.Ym }}
  141. ${{ runner.os }}-node_modules_prod-${{ matrix.node-version }}-${{ steps.date.outputs.Y }}
  142. - name: Get yarn cache dir
  143. id: cache-yarn
  144. run: echo "::set-output name=dir::$(yarn cache dir)"
  145. - name: Cache/Restore yarn cache
  146. uses: actions/cache@v2
  147. with:
  148. path: ${{ steps.cache-yarn.outputs.dir }}
  149. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('./yarn.lock') }}
  150. restore-keys: |
  151. ${{ runner.os }}-yarn-
  152. - name: Install dependencies
  153. run: |
  154. yarn
  155. - name: Print dependencies
  156. run: |
  157. echo -n "node " && node -v
  158. echo -n "npm " && npm -v
  159. yarn list --depth=0
  160. - name: yarn build
  161. run: |
  162. yarn build
  163. - name: yarn install --production
  164. run: |
  165. yarn install --production
  166. - name: Print dependencies
  167. run: |
  168. echo -n "node " && node -v
  169. echo -n "npm " && npm -v
  170. yarn list --production --depth=0
  171. - name: yarn start:prod:ci
  172. run: |
  173. yarn start:prod:ci
  174. - name: Upload report as artifact
  175. uses: actions/upload-artifact@v2
  176. with:
  177. name: Report
  178. path: report
  179. - name: Slack Notification
  180. uses: weseek/ghaction-slack-notification@master
  181. if: failure()
  182. with:
  183. type: ${{ job.status }}
  184. job_name: '*Node CI for growi-bot-proxy - launch-prod (${{ matrix.node-version }})*'
  185. channel: '#ci'
  186. isCompactMode: true
  187. url: ${{ secrets.SLACK_WEBHOOK_URL }}