ci-bot-proxy.yml 6.0 KB

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