test.yml 3.5 KB

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