test.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. name: Test
  2. permissions: {}
  3. on:
  4. push:
  5. pull_request:
  6. types: [synchronize, opened]
  7. schedule:
  8. - cron: '0 3 * * 1-5'
  9. jobs:
  10. test:
  11. runs-on: ubuntu-latest
  12. services:
  13. redis:
  14. image: redis
  15. ports:
  16. - 6379:6379
  17. postgres:
  18. image: postgres:10
  19. ports:
  20. - 5432:5432
  21. env:
  22. POSTGRES_USER: peertube
  23. POSTGRES_HOST_AUTH_METHOD: trust
  24. ldap:
  25. image: chocobozzz/docker-test-openldap
  26. ports:
  27. - 10389:10389
  28. s3ninja:
  29. image: chocobozzz/s3-ninja
  30. ports:
  31. - 9444:9000
  32. strategy:
  33. fail-fast: false
  34. matrix:
  35. test_suite: [ types-package, client, api-1, api-2, api-3, api-4, api-5, transcription, cli-plugin, lint, external-plugins ]
  36. env:
  37. PGUSER: peertube
  38. PGHOST: localhost
  39. NODE_PENDING_JOB_WAIT: 250
  40. ENABLE_OBJECT_STORAGE_TESTS: true
  41. # Github runner IPs are blocked by youtube
  42. DISABLE_HTTP_YOUTUBE_IMPORT_TESTS: true
  43. ENABLE_FFMPEG_THUMBNAIL_PIXEL_COMPARISON_TESTS: true
  44. OBJECT_STORAGE_SCALEWAY_KEY_ID: ${{ secrets.OBJECT_STORAGE_SCALEWAY_KEY_ID }}
  45. OBJECT_STORAGE_SCALEWAY_ACCESS_KEY: ${{ secrets.OBJECT_STORAGE_SCALEWAY_ACCESS_KEY }}
  46. YOUTUBE_DL_DOWNLOAD_BEARER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  47. YOUTUBE_DL_PROXY: ${{ secrets.YOUTUBE_DL_PROXY }}
  48. steps:
  49. - uses: actions/checkout@v4
  50. - uses: './.github/actions/reusable-prepare-peertube-build'
  51. with:
  52. node-version: '18.x'
  53. - uses: './.github/actions/reusable-prepare-peertube-run'
  54. - name: Cache fixtures
  55. uses: actions/cache@v4
  56. with:
  57. path: |
  58. fixtures
  59. key: ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-${{ hashFiles('fixtures/*') }}
  60. restore-keys: |
  61. ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-
  62. ${{ runner.OS }}-fixtures-
  63. ${{ runner.OS }}-
  64. - name: Cache PeerTube pip directory
  65. uses: actions/cache@v4
  66. with:
  67. path: |
  68. ~/.cache/pip
  69. key: ${{ runner.OS }}-${{ matrix.test_suite }}-pip-v1
  70. - name: Cache Hugging Face models
  71. uses: actions/cache@v4
  72. with:
  73. path: |
  74. ~/.cache/huggingface
  75. key: ${{ runner.OS }}-${{ matrix.test_suite }}-hugging-face-v1
  76. - name: Set env test variable (schedule)
  77. if: github.event_name != 'schedule'
  78. run: |
  79. echo "DISABLE_HTTP_IMPORT_TESTS=true" >> $GITHUB_ENV
  80. - name: Run Test
  81. # external-plugins tests only run on schedule
  82. if: github.event_name == 'schedule' || matrix.test_suite != 'external-plugins'
  83. env:
  84. AKISMET_KEY: ${{ secrets.AKISMET_KEY }}
  85. run: npm run ci -- ${{ matrix.test_suite }}
  86. - name: Display errors
  87. if: ${{ always() }}
  88. run: |
  89. ( \
  90. test -f dist/scripts/parse-log.js && \
  91. NODE_ENV=test node dist/scripts/parse-log.js -l error -f artifacts/*.log \
  92. ) || \
  93. echo "parse-log.js script does not exist, skipping."
  94. - name: Upload logs
  95. uses: actions/upload-artifact@v4
  96. if: failure()
  97. with:
  98. name: test-storages-${{ matrix.test_suite }}
  99. path: artifacts
  100. retention-days: 7