test.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. name: Test Suite
  2. on:
  3. push:
  4. branches:
  5. - develop
  6. - master
  7. pull_request:
  8. types: [synchronize, opened]
  9. schedule:
  10. - cron: '0 3 * * 1-5'
  11. jobs:
  12. test:
  13. runs-on: ubuntu-latest
  14. services:
  15. redis:
  16. image: redis
  17. ports:
  18. - 6379:6379
  19. postgres:
  20. image: postgres:9.6
  21. ports:
  22. - 5432:5432
  23. env:
  24. POSTGRES_USER: peertube
  25. POSTGRES_HOST_AUTH_METHOD: trust
  26. ldap:
  27. image: chocobozzz/docker-test-openldap
  28. ports:
  29. - 10389:10389
  30. strategy:
  31. fail-fast: false
  32. matrix:
  33. test_suite: [ misc, api-1, api-2, api-3, api-4, cli, lint, external-plugins ]
  34. env:
  35. PGUSER: peertube
  36. PGHOST: localhost
  37. NODE_PENDING_JOB_WAIT: 2000
  38. steps:
  39. - uses: actions/checkout@v2
  40. - name: Use Node.js
  41. uses: actions/setup-node@v1
  42. with:
  43. node-version: '12.x'
  44. - name: Setup system dependencies
  45. run: |
  46. sudo apt-get install postgresql-client-common redis-tools parallel
  47. wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz"
  48. tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz
  49. mkdir -p $HOME/bin
  50. cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
  51. echo "$HOME/bin" >> $GITHUB_PATH
  52. - name: Cache Node.js modules
  53. uses: actions/cache@v2
  54. with:
  55. path: |
  56. **/node_modules
  57. key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
  58. restore-keys: |
  59. ${{ runner.OS }}-node-
  60. ${{ runner.OS }}-
  61. - name: Cache fixtures
  62. uses: actions/cache@v2
  63. with:
  64. path: |
  65. fixtures
  66. key: ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-${{ hashFiles('fixtures/*') }}
  67. restore-keys: |
  68. ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-
  69. ${{ runner.OS }}-fixtures-
  70. ${{ runner.OS }}-
  71. - name: Install dependencies
  72. run: yarn install --frozen-lockfile
  73. - name: Set env test variable (schedule)
  74. if: github.event_name != 'schedule'
  75. run: |
  76. echo "DISABLE_HTTP_IMPORT_TESTS=true" >> $GITHUB_ENV
  77. - name: Run Test
  78. # external-plugins tests only run on schedule
  79. if: github.event_name == 'schedule' || matrix.test_suite != 'external-plugins'
  80. run: NODE_PENDING_JOB_WAIT=2000 npm run ci -- ${{ matrix.test_suite }}
  81. - name: Display errors
  82. if: ${{ always() }}
  83. run: |
  84. ( \
  85. test -f dist/scripts/parse-log.js && \
  86. cat *-ci.log | uniq -c && \
  87. NODE_ENV=test node dist/scripts/parse-log.js -l error -f artifacts/*.log \
  88. ) || \
  89. echo "parse-log.js script does not exist, skipping."
  90. - name: Upload logs
  91. uses: actions/upload-artifact@v2
  92. if: failure()
  93. with:
  94. name: test-storages-${{ matrix.test_suite }}
  95. path: artifacts
  96. retention-days: 7