ci-bot-proxy.yml 6.0 KB

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