diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/clean/server/test.sh | 9 | ||||
-rwxr-xr-x | scripts/create-transcoding-job.ts | 13 | ||||
-rwxr-xr-x | scripts/setup/cli.sh | 15 | ||||
-rwxr-xr-x | scripts/test.sh | 2 | ||||
-rwxr-xr-x | scripts/travis.sh | 9 |
5 files changed, 32 insertions, 16 deletions
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh index 5694ac922..20745170d 100755 --- a/scripts/clean/server/test.sh +++ b/scripts/clean/server/test.sh | |||
@@ -13,12 +13,15 @@ recreateDB () { | |||
13 | } | 13 | } |
14 | 14 | ||
15 | removeFiles () { | 15 | removeFiles () { |
16 | rm -rf "./test$1" "./config/local-test.json" "./config/local-test-$1.json" | 16 | rm -rf "./test$1" "./config/local-test.json" "./config/local-test-$1.json" ~/.config/PeerTube/CLI-$1 |
17 | } | 17 | } |
18 | 18 | ||
19 | dropRedis () { | 19 | dropRedis () { |
20 | redis-cli KEYS "bull-localhost:900$1*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL | 20 | port=$((9000+$1)) |
21 | redis-cli KEYS "redis-localhost:900$1*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL | 21 | |
22 | redis-cli KEYS "bull-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL | ||
23 | redis-cli KEYS "redis-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL | ||
24 | redis-cli KEYS "*redis-localhost:$port-" | grep -v empty | xargs --no-run-if-empty redis-cli DEL | ||
22 | } | 25 | } |
23 | 26 | ||
24 | seq=$(seq 1 6) | 27 | seq=$(seq 1 6) |
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts index 4a677eacb..2b7cb5177 100755 --- a/scripts/create-transcoding-job.ts +++ b/scripts/create-transcoding-job.ts | |||
@@ -2,6 +2,7 @@ import * as program from 'commander' | |||
2 | import { VideoModel } from '../server/models/video/video' | 2 | import { VideoModel } from '../server/models/video/video' |
3 | import { initDatabaseModels } from '../server/initializers' | 3 | import { initDatabaseModels } from '../server/initializers' |
4 | import { JobQueue } from '../server/lib/job-queue' | 4 | import { JobQueue } from '../server/lib/job-queue' |
5 | import { VideoTranscodingPayload } from '../server/lib/job-queue/handlers/video-transcoding' | ||
5 | 6 | ||
6 | program | 7 | program |
7 | .option('-v, --video [videoUUID]', 'Video UUID') | 8 | .option('-v, --video [videoUUID]', 'Video UUID') |
@@ -31,15 +32,9 @@ async function run () { | |||
31 | const video = await VideoModel.loadByUUIDWithFile(program['video']) | 32 | const video = await VideoModel.loadByUUIDWithFile(program['video']) |
32 | if (!video) throw new Error('Video not found.') | 33 | if (!video) throw new Error('Video not found.') |
33 | 34 | ||
34 | const dataInput = { | 35 | const dataInput: VideoTranscodingPayload = program.resolution !== undefined |
35 | videoUUID: video.uuid, | 36 | ? { type: 'new-resolution' as 'new-resolution', videoUUID: video.uuid, isNewVideo: false, resolution: program.resolution } |
36 | isNewVideo: false, | 37 | : { type: 'optimize' as 'optimize', videoUUID: video.uuid, isNewVideo: false } |
37 | resolution: undefined | ||
38 | } | ||
39 | |||
40 | if (program.resolution !== undefined) { | ||
41 | dataInput.resolution = program.resolution | ||
42 | } | ||
43 | 38 | ||
44 | await JobQueue.Instance.init() | 39 | await JobQueue.Instance.init() |
45 | await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput }) | 40 | await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput }) |
diff --git a/scripts/setup/cli.sh b/scripts/setup/cli.sh new file mode 100755 index 000000000..f761d7f8a --- /dev/null +++ b/scripts/setup/cli.sh | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | set -eu | ||
4 | |||
5 | NOCLIENT=1 yarn install --pure-lockfile | ||
6 | |||
7 | rm -rf ./dist/server/tools/ | ||
8 | |||
9 | ( | ||
10 | cd ./server/tools | ||
11 | yarn install --pure-lockfile | ||
12 | ) | ||
13 | |||
14 | npm run tsc -- --build ./server/tools/tsconfig.json | ||
15 | cp -r "./server/tools/node_modules" "./dist/server/tools" | ||
diff --git a/scripts/test.sh b/scripts/test.sh index cf8895365..5ec7a5920 100755 --- a/scripts/test.sh +++ b/scripts/test.sh | |||
@@ -3,6 +3,8 @@ | |||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | npm run build:server | 5 | npm run build:server |
6 | npm run setup:cli | ||
7 | |||
6 | npm run travis -- lint | 8 | npm run travis -- lint |
7 | 9 | ||
8 | mocha --exit --require ts-node/register/type-check --bail server/tests/index.ts | 10 | mocha --exit --require ts-node/register/type-check --bail server/tests/index.ts |
diff --git a/scripts/travis.sh b/scripts/travis.sh index 3557816c8..664d9fd6c 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh | |||
@@ -17,19 +17,20 @@ if [ "$1" = "misc" ]; then | |||
17 | server/tests/helpers/index.ts | 17 | server/tests/helpers/index.ts |
18 | elif [ "$1" = "cli" ]; then | 18 | elif [ "$1" = "cli" ]; then |
19 | npm run build:server | 19 | npm run build:server |
20 | CC=gcc-4.9 CXX=g++-4.9 npm run setup:cli | ||
20 | mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/cli/index.ts | 21 | mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/cli/index.ts |
21 | elif [ "$1" = "api-1" ]; then | 22 | elif [ "$1" = "api-1" ]; then |
22 | npm run build:server | 23 | npm run build:server |
23 | mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/api/index-1.ts | 24 | sh ./server/tests/api/travis-1.sh 2 |
24 | elif [ "$1" = "api-2" ]; then | 25 | elif [ "$1" = "api-2" ]; then |
25 | npm run build:server | 26 | npm run build:server |
26 | mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/api/index-2.ts | 27 | sh ./server/tests/api/travis-2.sh 2 |
27 | elif [ "$1" = "api-3" ]; then | 28 | elif [ "$1" = "api-3" ]; then |
28 | npm run build:server | 29 | npm run build:server |
29 | mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/api/index-3.ts | 30 | sh ./server/tests/api/travis-3.sh 2 |
30 | elif [ "$1" = "api-4" ]; then | 31 | elif [ "$1" = "api-4" ]; then |
31 | npm run build:server | 32 | npm run build:server |
32 | mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/api/index-4.ts | 33 | sh ./server/tests/api/travis-4.sh 2 |
33 | elif [ "$1" = "lint" ]; then | 34 | elif [ "$1" = "lint" ]; then |
34 | npm run tslint -- --project ./tsconfig.json -c ./tslint.json server.ts "server/**/*.ts" "shared/**/*.ts" | 35 | npm run tslint -- --project ./tsconfig.json -c ./tslint.json server.ts "server/**/*.ts" "shared/**/*.ts" |
35 | 36 | ||