aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/clean/server/test.sh9
-rwxr-xr-xscripts/create-transcoding-job.ts13
-rwxr-xr-xscripts/setup/cli.sh15
-rwxr-xr-xscripts/test.sh2
-rwxr-xr-xscripts/travis.sh9
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
15removeFiles () { 15removeFiles () {
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
19dropRedis () { 19dropRedis () {
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
24seq=$(seq 1 6) 27seq=$(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'
2import { VideoModel } from '../server/models/video/video' 2import { VideoModel } from '../server/models/video/video'
3import { initDatabaseModels } from '../server/initializers' 3import { initDatabaseModels } from '../server/initializers'
4import { JobQueue } from '../server/lib/job-queue' 4import { JobQueue } from '../server/lib/job-queue'
5import { VideoTranscodingPayload } from '../server/lib/job-queue/handlers/video-transcoding'
5 6
6program 7program
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
3set -eu
4
5NOCLIENT=1 yarn install --pure-lockfile
6
7rm -rf ./dist/server/tools/
8
9(
10 cd ./server/tools
11 yarn install --pure-lockfile
12)
13
14npm run tsc -- --build ./server/tools/tsconfig.json
15cp -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 @@
3set -eu 3set -eu
4 4
5npm run build:server 5npm run build:server
6npm run setup:cli
7
6npm run travis -- lint 8npm run travis -- lint
7 9
8mocha --exit --require ts-node/register/type-check --bail server/tests/index.ts 10mocha --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
18elif [ "$1" = "cli" ]; then 18elif [ "$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
21elif [ "$1" = "api-1" ]; then 22elif [ "$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
24elif [ "$1" = "api-2" ]; then 25elif [ "$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
27elif [ "$1" = "api-3" ]; then 28elif [ "$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
30elif [ "$1" = "api-4" ]; then 31elif [ "$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
33elif [ "$1" = "lint" ]; then 34elif [ "$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