ci-bot-proxy.yml 6.1 KB

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