ci.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. name: Node CI
  2. # on: [push]
  3. on:
  4. push:
  5. branches:
  6. - dummy
  7. jobs:
  8. resolve-dependencies:
  9. runs-on: ubuntu-latest
  10. strategy:
  11. matrix:
  12. node-version: [10.x, 12.x]
  13. steps:
  14. - uses: actions/checkout@v1
  15. - name: Use Node.js ${{ matrix.node-version }}
  16. uses: actions/setup-node@v1
  17. with:
  18. node-version: ${{ matrix.node-version }}
  19. - name: Cache/Restore node_modules
  20. id: cache
  21. uses: actions/cache@v1
  22. with:
  23. path: node_modules
  24. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  25. - name: install dependencies
  26. if: steps.cache.outputs.cache-hit != 'true'
  27. run: |
  28. yarn
  29. - name: install plugins
  30. if: steps.cache.outputs.cache-hit != 'true'
  31. run: |
  32. yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs
  33. yarn add -D react-images react-motion
  34. - name: print dependencies
  35. run: |
  36. echo -n "node " && node -v
  37. echo -n "npm " && npm -v
  38. yarn list --depth=0
  39. test:
  40. runs-on: ubuntu-latest
  41. needs: resolve-dependencies
  42. strategy:
  43. matrix:
  44. node-version: [10.x, 12.x]
  45. steps:
  46. - uses: actions/checkout@v1
  47. - name: Use Node.js ${{ matrix.node-version }}
  48. uses: actions/setup-node@v1
  49. with:
  50. node-version: ${{ matrix.node-version }}
  51. - name: Cache/Restore node_modules
  52. uses: actions/cache@v1
  53. with:
  54. path: node_modules
  55. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  56. - uses: actions/checkout@v1
  57. - name: yarn lint
  58. run: |
  59. yarn lint
  60. - name: Launch MongoDB
  61. uses: wbari/start-mongoDB@v0.2
  62. with:
  63. mongoDBVersion: 3.6
  64. - name: yarn test
  65. run: |
  66. yarn test
  67. env:
  68. MONGO_URI: mongodb://localhost:27017/growi_test
  69. build-dev:
  70. runs-on: ubuntu-latest
  71. needs: resolve-dependencies
  72. strategy:
  73. matrix:
  74. node-version: [10.x, 12.x]
  75. steps:
  76. - uses: actions/checkout@v1
  77. - name: Use Node.js ${{ matrix.node-version }}
  78. uses: actions/setup-node@v1
  79. with:
  80. node-version: ${{ matrix.node-version }}
  81. - name: Cache/Restore node_modules
  82. uses: actions/cache@v1
  83. with:
  84. path: node_modules
  85. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  86. - name: yarn build:dev
  87. run: |
  88. yarn build:dev
  89. build-prod:
  90. runs-on: ubuntu-latest
  91. needs: resolve-dependencies
  92. strategy:
  93. matrix:
  94. node-version: [10.x, 12.x]
  95. steps:
  96. - uses: actions/checkout@v1
  97. - name: Use Node.js ${{ matrix.node-version }}
  98. uses: actions/setup-node@v1
  99. with:
  100. node-version: ${{ matrix.node-version }}
  101. - name: Cache/Restore node_modules
  102. uses: actions/cache@v1
  103. with:
  104. path: node_modules
  105. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-build-prod
  106. restore-keys: |
  107. ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  108. ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-build-prod
  109. - name: Launch MongoDB
  110. uses: wbari/start-mongoDB@v0.2
  111. with:
  112. mongoDBVersion: 3.6
  113. - name: yarn build:prod:analyze
  114. run: |
  115. yarn build:prod:analyze
  116. - name: shrink dependencies for production
  117. run: |
  118. yarn install --production
  119. - name: yarn server:prod:ci
  120. run: |
  121. yarn server:prod:ci
  122. env:
  123. MONGO_URI: mongodb://localhost:27017/growi