diff options
Diffstat (limited to 'scripts/ci.sh')
-rwxr-xr-x | scripts/ci.sh | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/scripts/ci.sh b/scripts/ci.sh index f4a200a00..07e37e0ee 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh | |||
@@ -25,7 +25,7 @@ runTest () { | |||
25 | joblog="$jobname-ci.log" | 25 | joblog="$jobname-ci.log" |
26 | 26 | ||
27 | parallel -j $jobs --retries $retries \ | 27 | parallel -j $jobs --retries $retries \ |
28 | "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail {}" \ | 28 | "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --require ./dist/server/tests/register.js --bail {}" \ |
29 | ::: $files | 29 | ::: $files |
30 | 30 | ||
31 | cat "$joblog" | uniq -c | 31 | cat "$joblog" | uniq -c |
@@ -33,63 +33,72 @@ runTest () { | |||
33 | } | 33 | } |
34 | 34 | ||
35 | findTestFiles () { | 35 | findTestFiles () { |
36 | find $1 -type f -name "*.ts" | grep -v "/index.ts" | xargs echo | 36 | exception="-not -name index.js" |
37 | |||
38 | if [ ! -z ${2+x} ]; then | ||
39 | exception="$exception -not -name $2" | ||
40 | fi | ||
41 | |||
42 | find $1 -type f -name "*.js" $exception | xargs echo | ||
37 | } | 43 | } |
38 | 44 | ||
39 | if [ "$1" = "misc" ]; then | 45 | if [ "$1" = "client" ]; then |
40 | npm run build | 46 | npm run build |
41 | 47 | ||
42 | feedsFiles=$(findTestFiles server/tests/feeds) | 48 | feedsFiles=$(findTestFiles ./dist/server/tests/feeds) |
43 | helperFiles=$(findTestFiles server/tests/helpers) | 49 | helperFiles=$(findTestFiles ./dist/server/tests/helpers) |
44 | pluginsFiles=$(findTestFiles server/tests/plugins) | 50 | miscFiles="./dist/server/tests/client.js ./dist/server/tests/misc-endpoints.js" |
45 | miscFiles="server/tests/client.ts server/tests/misc-endpoints.ts" | 51 | # Not in plugin task, it needs an index.html |
52 | pluginFiles="./dist/server/tests/plugins/html-injection.js" | ||
46 | 53 | ||
47 | MOCHA_PARALLEL=true TS_NODE_FILES=true runTest "$1" 2 $feedsFiles $helperFiles $pluginsFiles $miscFiles | 54 | MOCHA_PARALLEL=true runTest "$1" 2 $feedsFiles $helperFiles $miscFiles $pluginFiles |
48 | elif [ "$1" = "cli" ]; then | 55 | elif [ "$1" = "cli-plugin" ]; then |
49 | npm run build:server | 56 | npm run build:server |
50 | npm run setup:cli | 57 | npm run setup:cli |
51 | 58 | ||
52 | cliFiles=$(findTestFiles server/tests/cli) | 59 | pluginsFiles=$(findTestFiles ./dist/server/tests/plugins html-injection.js) |
60 | cliFiles=$(findTestFiles ./dist/server/tests/cli) | ||
53 | 61 | ||
62 | MOCHA_PARALLEL=true runTest "$1" 2 $pluginsFiles | ||
54 | runTest "$1" 1 $cliFiles | 63 | runTest "$1" 1 $cliFiles |
55 | elif [ "$1" = "api-1" ]; then | 64 | elif [ "$1" = "api-1" ]; then |
56 | npm run build:server | 65 | npm run build:server |
57 | 66 | ||
58 | checkParamFiles=$(findTestFiles server/tests/api/check-params) | 67 | checkParamFiles=$(findTestFiles ./dist/server/tests/api/check-params) |
59 | notificationsFiles=$(findTestFiles server/tests/api/notifications) | 68 | notificationsFiles=$(findTestFiles ./dist/server/tests/api/notifications) |
60 | searchFiles=$(findTestFiles server/tests/api/search) | 69 | searchFiles=$(findTestFiles ./dist/server/tests/api/search) |
61 | 70 | ||
62 | MOCHA_PARALLEL=true runTest "$1" 3 $notificationsFiles $searchFiles $checkParamFiles | 71 | MOCHA_PARALLEL=true runTest "$1" 3 $notificationsFiles $searchFiles $checkParamFiles |
63 | elif [ "$1" = "api-2" ]; then | 72 | elif [ "$1" = "api-2" ]; then |
64 | npm run build:server | 73 | npm run build:server |
65 | 74 | ||
66 | serverFiles=$(findTestFiles server/tests/api/server) | 75 | liveFiles=$(findTestFiles ./dist/server/tests/api/live) |
67 | usersFiles=$(findTestFiles server/tests/api/users) | 76 | serverFiles=$(findTestFiles ./dist/server/tests/api/server) |
68 | liveFiles=$(findTestFiles server/tests/api/live) | 77 | usersFiles=$(findTestFiles ./dist/server/tests/api/users) |
69 | 78 | ||
70 | MOCHA_PARALLEL=true runTest "$1" 3 $serverFiles $usersFiles $liveFiles | 79 | MOCHA_PARALLEL=true runTest "$1" 3 $serverFiles $usersFiles $liveFiles |
71 | elif [ "$1" = "api-3" ]; then | 80 | elif [ "$1" = "api-3" ]; then |
72 | npm run build:server | 81 | npm run build:server |
73 | 82 | ||
74 | videosFiles=$(findTestFiles server/tests/api/videos) | 83 | videosFiles=$(findTestFiles ./dist/server/tests/api/videos) |
75 | 84 | ||
76 | MOCHA_PARALLEL=true runTest "$1" 3 $videosFiles | 85 | MOCHA_PARALLEL=true runTest "$1" 3 $videosFiles |
77 | elif [ "$1" = "api-4" ]; then | 86 | elif [ "$1" = "api-4" ]; then |
78 | npm run build:server | 87 | npm run build:server |
79 | 88 | ||
80 | moderationFiles=$(findTestFiles server/tests/api/moderation) | 89 | moderationFiles=$(findTestFiles ./dist/server/tests/api/moderation) |
81 | redundancyFiles=$(findTestFiles server/tests/api/redundancy) | 90 | redundancyFiles=$(findTestFiles ./dist/server/tests/api/redundancy) |
82 | activitypubFiles=$(findTestFiles server/tests/api/activitypub) | 91 | activitypubFiles=$(findTestFiles ./dist/server/tests/api/activitypub) |
83 | 92 | ||
84 | MOCHA_PARALLEL=true TS_NODE_FILES=true runTest "$1" 2 $moderationFiles $redundancyFiles $activitypubFiles | 93 | MOCHA_PARALLEL=true TS_NODE_FILES=true runTest "$1" 2 $moderationFiles $redundancyFiles $activitypubFiles |
85 | elif [ "$1" = "external-plugins" ]; then | 94 | elif [ "$1" = "external-plugins" ]; then |
86 | npm run build:server | 95 | npm run build:server |
87 | 96 | ||
88 | externalPluginsFiles=$(findTestFiles server/tests/external-plugins) | 97 | externalPluginsFiles=$(findTestFiles ./dist/server/tests/external-plugins) |
89 | 98 | ||
90 | runTest "$1" 1 $externalPluginsFiles | 99 | runTest "$1" 1 $externalPluginsFiles |
91 | elif [ "$1" = "lint" ]; then | 100 | elif [ "$1" = "lint" ]; then |
92 | npm run eslint -- --ext .ts "server/**/*.ts" "shared/**/*.ts" "scripts/**/*.ts" | 101 | npm run eslint -- --ext .ts "./server/**/*.ts" "shared/**/*.ts" "scripts/**/*.ts" |
93 | npm run swagger-cli -- validate support/doc/api/openapi.yaml | 102 | npm run swagger-cli -- validate support/doc/api/openapi.yaml |
94 | 103 | ||
95 | ( cd client | 104 | ( cd client |