Federated video streaming platform using ActivityPub and P2P in the web browser with Angular. https://joinpeertube.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

111 lines
3.3 KiB

  1. #!/bin/bash
  2. set -eu
  3. if [ $# -eq 0 ]; then
  4. echo "Need test suite argument."
  5. exit -1
  6. fi
  7. retries=3
  8. runTest () {
  9. jobname=$1
  10. shift
  11. jobs=$1
  12. shift
  13. files=$@
  14. echo $files
  15. joblog="$jobname-ci.log"
  16. parallel -j $jobs --retries $retries \
  17. "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --bail {}" \
  18. ::: $files
  19. cat "$joblog" | uniq -c
  20. rm "$joblog"
  21. }
  22. findTestFiles () {
  23. exception="-not -name index.js"
  24. if [ ! -z ${2+x} ]; then
  25. exception="$exception -not -name $2"
  26. fi
  27. find $1 -type f -name "*.js" $exception | xargs echo
  28. }
  29. if [ "$1" = "types-package" ]; then
  30. npm run generate-types-package 0.0.0
  31. npm run tsc -- --noEmit --esModuleInterop packages/types/tests/test.ts
  32. elif [ "$1" = "client" ]; then
  33. npm run build
  34. feedsFiles=$(findTestFiles ./dist/server/tests/feeds)
  35. helperFiles=$(findTestFiles ./dist/server/tests/helpers)
  36. libFiles=$(findTestFiles ./dist/server/tests/lib)
  37. miscFiles="./dist/server/tests/client.js ./dist/server/tests/misc-endpoints.js"
  38. # Not in plugin task, it needs an index.html
  39. pluginFiles="./dist/server/tests/plugins/html-injection.js"
  40. MOCHA_PARALLEL=true runTest "$1" 2 $feedsFiles $helperFiles $miscFiles $pluginFiles $libFiles
  41. elif [ "$1" = "cli-plugin" ]; then
  42. npm run build:server
  43. npm run setup:cli
  44. pluginsFiles=$(findTestFiles ./dist/server/tests/plugins html-injection.js)
  45. cliFiles=$(findTestFiles ./dist/server/tests/cli)
  46. MOCHA_PARALLEL=true runTest "$1" 2 $pluginsFiles
  47. runTest "$1" 1 $cliFiles
  48. elif [ "$1" = "api-1" ]; then
  49. npm run build:server
  50. checkParamFiles=$(findTestFiles ./dist/server/tests/api/check-params)
  51. notificationsFiles=$(findTestFiles ./dist/server/tests/api/notifications)
  52. searchFiles=$(findTestFiles ./dist/server/tests/api/search)
  53. MOCHA_PARALLEL=true runTest "$1" 3 $notificationsFiles $searchFiles $checkParamFiles
  54. elif [ "$1" = "api-2" ]; then
  55. npm run build:server
  56. liveFiles=$(findTestFiles ./dist/server/tests/api/live)
  57. serverFiles=$(findTestFiles ./dist/server/tests/api/server)
  58. usersFiles=$(findTestFiles ./dist/server/tests/api/users)
  59. MOCHA_PARALLEL=true runTest "$1" 3 $liveFiles $serverFiles $usersFiles
  60. elif [ "$1" = "api-3" ]; then
  61. npm run build:server
  62. videosFiles=$(findTestFiles ./dist/server/tests/api/videos)
  63. MOCHA_PARALLEL=true runTest "$1" 3 $videosFiles
  64. elif [ "$1" = "api-4" ]; then
  65. npm run build:server
  66. moderationFiles=$(findTestFiles ./dist/server/tests/api/moderation)
  67. redundancyFiles=$(findTestFiles ./dist/server/tests/api/redundancy)
  68. objectStorageFiles=$(findTestFiles ./dist/server/tests/api/object-storage)
  69. activitypubFiles=$(findTestFiles ./dist/server/tests/api/activitypub)
  70. MOCHA_PARALLEL=true runTest "$1" 2 $moderationFiles $redundancyFiles $activitypubFiles $objectStorageFiles
  71. elif [ "$1" = "external-plugins" ]; then
  72. npm run build:server
  73. externalPluginsFiles=$(findTestFiles ./dist/server/tests/external-plugins)
  74. runTest "$1" 1 $externalPluginsFiles
  75. elif [ "$1" = "lint" ]; then
  76. npm run eslint -- --ext .ts "./server/**/*.ts" "shared/**/*.ts" "scripts/**/*.ts"
  77. npm run swagger-cli -- validate support/doc/api/openapi.yaml
  78. ( cd client
  79. npm run lint
  80. )
  81. fi