X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fci.sh;h=2bacf2a2e18d23c34de46f7081bce669ec2b9336;hb=be858676fd3e1c5f7b2b87427192fde4031457ad;hp=7360a03ce8853286e82f2b05acf0bffc1683cdb6;hpb=3d470a530c4a48b2e4f4a9e7d4f223e14f32cea4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/ci.sh b/scripts/ci.sh index 7360a03ce..2bacf2a2e 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -7,8 +7,6 @@ if [ $# -eq 0 ]; then exit -1 fi -killall -q peertube || true - retries=3 runTest () { @@ -25,7 +23,7 @@ runTest () { joblog="$jobname-ci.log" parallel -j $jobs --retries $retries \ - "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --require ./dist/server/tests/register.js --bail {}" \ + "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --bail {}" \ ::: $files cat "$joblog" | uniq -c @@ -33,24 +31,37 @@ runTest () { } findTestFiles () { - find $1 -type f -name "*.js" | grep -v "/index.js" | xargs echo + exception="-not -name index.js" + + if [ ! -z ${2+x} ]; then + exception="$exception -not -name $2" + fi + + find $1 -type f -name "*.js" $exception | xargs echo } -if [ "$1" = "misc" ]; then +if [ "$1" = "types-package" ]; then + npm run generate-types-package 0.0.0 + npm run tsc -- --noEmit --esModuleInterop packages/types/tests/test.ts +elif [ "$1" = "client" ]; then npm run build feedsFiles=$(findTestFiles ./dist/server/tests/feeds) helperFiles=$(findTestFiles ./dist/server/tests/helpers) - pluginsFiles=$(findTestFiles ./dist/server/tests/plugins) + libFiles=$(findTestFiles ./dist/server/tests/lib) miscFiles="./dist/server/tests/client.js ./dist/server/tests/misc-endpoints.js" + # Not in plugin task, it needs an index.html + pluginFiles="./dist/server/tests/plugins/html-injection.js" - MOCHA_PARALLEL=true runTest "$1" 2 $feedsFiles $helperFiles $pluginsFiles $miscFiles -elif [ "$1" = "cli" ]; then + MOCHA_PARALLEL=true runTest "$1" 2 $feedsFiles $helperFiles $miscFiles $pluginFiles $libFiles +elif [ "$1" = "cli-plugin" ]; then npm run build:server npm run setup:cli + pluginsFiles=$(findTestFiles ./dist/server/tests/plugins html-injection.js) cliFiles=$(findTestFiles ./dist/server/tests/cli) + MOCHA_PARALLEL=true runTest "$1" 2 $pluginsFiles runTest "$1" 1 $cliFiles elif [ "$1" = "api-1" ]; then npm run build:server @@ -63,11 +74,11 @@ elif [ "$1" = "api-1" ]; then elif [ "$1" = "api-2" ]; then npm run build:server + liveFiles=$(findTestFiles ./dist/server/tests/api/live) serverFiles=$(findTestFiles ./dist/server/tests/api/server) usersFiles=$(findTestFiles ./dist/server/tests/api/users) - liveFiles=$(findTestFiles ./dist/server/tests/api/live) - MOCHA_PARALLEL=true runTest "$1" 3 $serverFiles $usersFiles $liveFiles + MOCHA_PARALLEL=true runTest "$1" 3 $liveFiles $serverFiles $usersFiles elif [ "$1" = "api-3" ]; then npm run build:server @@ -79,9 +90,10 @@ elif [ "$1" = "api-4" ]; then moderationFiles=$(findTestFiles ./dist/server/tests/api/moderation) redundancyFiles=$(findTestFiles ./dist/server/tests/api/redundancy) + objectStorageFiles=$(findTestFiles ./dist/server/tests/api/object-storage) activitypubFiles=$(findTestFiles ./dist/server/tests/api/activitypub) - MOCHA_PARALLEL=true TS_NODE_FILES=true runTest "$1" 2 $moderationFiles $redundancyFiles $activitypubFiles + MOCHA_PARALLEL=true runTest "$1" 2 $moderationFiles $redundancyFiles $activitypubFiles $objectStorageFiles elif [ "$1" = "external-plugins" ]; then npm run build:server