aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-30 14:44:08 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-07-31 11:32:04 +0200
commit7abb5c5da1ed7c6945e81b9e3da0a14f623f69ea (patch)
treeb8b1aa1fe87b081bacd7013ffce4d11ad66b5192 /scripts
parentb488ba1e26b803ac6c637e8b11bdd444ca4c803f (diff)
downloadPeerTube-7abb5c5da1ed7c6945e81b9e3da0a14f623f69ea.tar.gz
PeerTube-7abb5c5da1ed7c6945e81b9e3da0a14f623f69ea.tar.zst
PeerTube-7abb5c5da1ed7c6945e81b9e3da0a14f623f69ea.zip
Use parallel to run tests in parallel
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ci.sh72
1 files changed, 56 insertions, 16 deletions
diff --git a/scripts/ci.sh b/scripts/ci.sh
index cef276da3..448c1c91f 100755
--- a/scripts/ci.sh
+++ b/scripts/ci.sh
@@ -9,42 +9,82 @@ fi
9 9
10killall -q peertube || true 10killall -q peertube || true
11 11
12perl -0777 -i -pe 's#proxy:(\n\s+)enabled: false\n\s+url: ""#proxy:$1enabled: true$1url: "http://188.165.225.149:7899"#' config/test.yaml 12retries=3
13jobs=2
14
15runTest () {
16 retries=3
17 jobs=$1
18 shift
19 files=$@
20
21 echo $files
22
23 MOCHA_PARALLEL=true parallel -t -j $jobs --retries $retries \
24 npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \
25 ::: $files
26}
27
28findTestFiles () {
29 find $1 -type f -name "*.ts" | grep -v index.ts | xargs echo
30}
13 31
14if [ "$1" = "misc" ]; then 32if [ "$1" = "misc" ]; then
15 npm run build -- --light 33 npm run build -- --light
16 TS_NODE_FILES=true mocha --timeout 5000 --exit --require ts-node/register --require tsconfig-paths/register --bail \ 34
17 server/tests/client.ts \ 35 feedsFiles=$(findTestFiles server/tests/feeds)
18 server/tests/feeds/index.ts \ 36 helperFiles=$(findTestFiles server/tests/helpers)
19 server/tests/misc-endpoints.ts \ 37 pluginsFiles=$(findTestFiles server/tests/plugins)
20 server/tests/helpers/index.ts \ 38 miscFiles=server/tests/client.ts server/tests/misc-endpoints.ts
21 server/tests/plugins/index.ts 39
40 TS_NODE_FILES=true runTest 2 $feedsFiles $helperFiles $pluginsFiles $miscFiles
22elif [ "$1" = "cli" ]; then 41elif [ "$1" = "cli" ]; then
23 npm run build:server 42 npm run build:server
24 npm run setup:cli 43 npm run setup:cli
25 mocha --timeout 5000 --exit --require ts-node/register --require tsconfig-paths/register --bail server/tests/cli/index.ts 44
45 cliFiles=$(findTestFiles server/tests/cli)
46
47 runTest 1 $cliFiles
26elif [ "$1" = "api-1" ]; then 48elif [ "$1" = "api-1" ]; then
27 npm run build:server 49 npm run build:server
28 sh ./server/tests/api/ci-1.sh 2 50
51 checkParamFiles=$(findTestFiles server/tests/api/check-params)
52 notificationsFiles=$(findTestFiles server/tests/api/notifications)
53 searchFiles=$(findTestFiles server/tests/api/search)
54
55 runTest 2 $notificationsFiles $searchFiles $checkParamFiles
29elif [ "$1" = "api-2" ]; then 56elif [ "$1" = "api-2" ]; then
30 npm run build:server 57 npm run build:server
31 sh ./server/tests/api/ci-2.sh 2 58
59 serverFiles=$(findTestFiles server/tests/api/server)
60 usersFiles=$(findTestFiles server/tests/api/users)
61
62 runTest 2 $serverFiles $usersFiles
32elif [ "$1" = "api-3" ]; then 63elif [ "$1" = "api-3" ]; then
33 npm run build:server 64 npm run build:server
34 sh ./server/tests/api/ci-3.sh 2 65
66 videosFiles=$(findTestFiles server/tests/api/videos)
67
68 runTest 1 $videosFiles
35elif [ "$1" = "api-4" ]; then 69elif [ "$1" = "api-4" ]; then
36 npm run build:server 70 npm run build:server
37 sh ./server/tests/api/ci-4.sh 2 71
72 activitypubFiles=$(findTestFiles server/tests/api/moderation)
73 redundancyFiles=$(findTestFiles server/tests/api/redundancy)
74 activitypubFiles=$(findTestFiles server/tests/api/activitypub)
75
76 TS_NODE_FILES=true runTest 2 $activitypubFiles $redundancyFiles $activitypubFiles
38elif [ "$1" = "external-plugins" ]; then 77elif [ "$1" = "external-plugins" ]; then
39 npm run build:server 78 npm run build:server
40 mocha --timeout 5000 --exit --require ts-node/register --require tsconfig-paths/register --bail server/tests/external-plugins/index.ts 79
80 externalPluginsFiles=$(findTestFiles server/tests/external-plugins)
81
82 runTest 1 $externalPluginsFiles
41elif [ "$1" = "lint" ]; then 83elif [ "$1" = "lint" ]; then
42 npm run eslint -- --ext .ts "server/**/*.ts" "shared/**/*.ts" 84 npm run eslint -- --ext .ts "server/**/*.ts" "shared/**/*.ts" "scripts/**/*.ts"
43 npm run swagger-cli -- validate support/doc/api/openapi.yaml 85 npm run swagger-cli -- validate support/doc/api/openapi.yaml
44 86
45 ( cd client 87 ( cd client
46 npm run lint 88 npm run lint
47 ) 89 )
48fi 90fi
49
50git checkout -- config/test.yaml