ci-bot-proxy.yml 6.2 KB

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