2
0

test.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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-${{ 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. steps:
  39. - name: Cache/Restore node_modules
  40. uses: actions/cache@v1
  41. with:
  42. path: node_modules
  43. key: ${{ runner.OS }}-node_modules-${{ hashFiles('**/yarn.lock') }}
  44. - uses: actions/checkout@v1
  45. - name: yarn lint
  46. run: |
  47. yarn lint
  48. test:
  49. runs-on: ubuntu-latest
  50. needs: resolve-dependencies
  51. steps:
  52. - name: Launch MongoDB
  53. uses: wbari/start-mongoDB@v0.2
  54. with:
  55. mongoDBVersion: 3.6
  56. - name: Cache/Restore node_modules
  57. uses: actions/cache@v1
  58. with:
  59. path: node_modules
  60. key: ${{ runner.OS }}-node_modules-${{ hashFiles('**/yarn.lock') }}
  61. - name: yarn test
  62. run: |
  63. yarn test
  64. env:
  65. MONGO_URI: mongodb://localhost:27017/growi_test
  66. build-dev:
  67. runs-on: ubuntu-latest
  68. needs: resolve-dependencies
  69. steps:
  70. - name: Cache/Restore node_modules
  71. uses: actions/cache@v1
  72. with:
  73. path: node_modules
  74. key: ${{ runner.OS }}-node_modules-${{ hashFiles('**/yarn.lock') }}
  75. - name: yarn build:dev
  76. run: |
  77. yarn build:dev
  78. build-prod:
  79. runs-on: ubuntu-latest
  80. needs: resolve-dependencies
  81. steps:
  82. - name: Launch MongoDB
  83. uses: wbari/start-mongoDB@v0.2
  84. with:
  85. mongoDBVersion: 3.6
  86. - name: Cache/Restore node_modules
  87. uses: actions/cache@v1
  88. with:
  89. path: node_modules
  90. key: ${{ runner.OS }}-node_modules-${{ hashFiles('**/yarn.lock') }}-build-prod
  91. restore-keys: |
  92. ${{ runner.OS }}-node_modules-${{ hashFiles('**/yarn.lock') }}
  93. ${{ runner.OS }}-node_modules-${{ hashFiles('**/yarn.lock') }}-build-prod
  94. - name: yarn build:prod:analyze
  95. run: |
  96. yarn build:prod:analyze
  97. - name: shrink dependencies for production
  98. run: |
  99. yarn install --production
  100. - name: yarn server:prod:ci
  101. run: |
  102. yarn server:prod:ci
  103. env:
  104. MONGO_URI: mongodb://localhost:27017/growi