diff options
-rw-r--r-- | .github/workflows/test.yml | 2 | ||||
-rw-r--r-- | .travis.yml | 58 | ||||
-rwxr-xr-x | scripts/ci.sh | 72 | ||||
-rw-r--r-- | server/tests/api/ci-1.sh | 10 | ||||
-rw-r--r-- | server/tests/api/ci-2.sh | 10 | ||||
-rw-r--r-- | server/tests/api/ci-3.sh | 8 | ||||
-rw-r--r-- | server/tests/api/ci-4.sh | 11 |
7 files changed, 57 insertions, 114 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a2f93ce3f..6b9119e2a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml | |||
@@ -42,7 +42,7 @@ jobs: | |||
42 | 42 | ||
43 | - name: Setup system dependencies | 43 | - name: Setup system dependencies |
44 | run: | | 44 | run: | |
45 | sudo apt-get install postgresql-client-common redis-tools | 45 | sudo apt-get install postgresql-client-common redis-tools parallel |
46 | wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.0.3-64bit-static.tar.xz" | 46 | wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.0.3-64bit-static.tar.xz" |
47 | tar xf ffmpeg-release-4.0.3-64bit-static.tar.xz | 47 | tar xf ffmpeg-release-4.0.3-64bit-static.tar.xz |
48 | mkdir -p $HOME/bin | 48 | mkdir -p $HOME/bin |
diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3d287a782..000000000 --- a/.travis.yml +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | language: node_js | ||
2 | |||
3 | node_js: | ||
4 | - "10" | ||
5 | |||
6 | git: | ||
7 | depth: 1 | ||
8 | |||
9 | addons: | ||
10 | apt: | ||
11 | sources: | ||
12 | - ubuntu-toolchain-r-test | ||
13 | packages: | ||
14 | - g++-4.9 | ||
15 | postgresql: "9.6" | ||
16 | |||
17 | cache: | ||
18 | directories: | ||
19 | - $HOME/.cache/yarn | ||
20 | - $HOME/fixtures | ||
21 | |||
22 | sudo: false | ||
23 | |||
24 | services: | ||
25 | - postgresql | ||
26 | - redis-server | ||
27 | |||
28 | install: | ||
29 | - CC=gcc-4.9 CXX=g++-4.9 yarn install | ||
30 | |||
31 | before_script: | ||
32 | - wget --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.0.3-64bit-static.tar.xz" | ||
33 | - tar xf ffmpeg-release-4.0.3-64bit-static.tar.xz | ||
34 | - mkdir -p $HOME/bin | ||
35 | - cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin | ||
36 | - export PATH=$HOME/bin:$PATH | ||
37 | - psql -c "create user peertube with password 'peertube';" -U postgres | ||
38 | |||
39 | matrix: | ||
40 | include: | ||
41 | - env: TEST_SUITE=misc | ||
42 | - env: TEST_SUITE=api-1 | ||
43 | - env: TEST_SUITE=api-2 | ||
44 | - env: TEST_SUITE=api-3 | ||
45 | - env: TEST_SUITE=api-4 | ||
46 | - env: TEST_SUITE=cli | ||
47 | - env: TEST_SUITE=lint | ||
48 | |||
49 | script: | ||
50 | - NODE_PENDING_JOB_WAIT=2000 travis_retry npm run ci -- "$TEST_SUITE" | ||
51 | |||
52 | after_failure: | ||
53 | - cat test1/logs/peertube.log | ||
54 | - cat test2/logs/peertube.log | ||
55 | - cat test3/logs/peertube.log | ||
56 | - cat test4/logs/peertube.log | ||
57 | - cat test5/logs/peertube.log | ||
58 | - cat test6/logs/peertube.log | ||
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 | ||
10 | killall -q peertube || true | 10 | killall -q peertube || true |
11 | 11 | ||
12 | perl -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 | 12 | retries=3 |
13 | jobs=2 | ||
14 | |||
15 | runTest () { | ||
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 | |||
28 | findTestFiles () { | ||
29 | find $1 -type f -name "*.ts" | grep -v index.ts | xargs echo | ||
30 | } | ||
13 | 31 | ||
14 | if [ "$1" = "misc" ]; then | 32 | if [ "$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 | ||
22 | elif [ "$1" = "cli" ]; then | 41 | elif [ "$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 | ||
26 | elif [ "$1" = "api-1" ]; then | 48 | elif [ "$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 | ||
29 | elif [ "$1" = "api-2" ]; then | 56 | elif [ "$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 | ||
32 | elif [ "$1" = "api-3" ]; then | 63 | elif [ "$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 | ||
35 | elif [ "$1" = "api-4" ]; then | 69 | elif [ "$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 | ||
38 | elif [ "$1" = "external-plugins" ]; then | 77 | elif [ "$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 | ||
41 | elif [ "$1" = "lint" ]; then | 83 | elif [ "$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 | ) |
48 | fi | 90 | fi |
49 | |||
50 | git checkout -- config/test.yaml | ||
diff --git a/server/tests/api/ci-1.sh b/server/tests/api/ci-1.sh deleted file mode 100644 index faa440785..000000000 --- a/server/tests/api/ci-1.sh +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | set -eu | ||
4 | |||
5 | checkParamFiles=$(find server/tests/api/check-params -type f | grep -v index.ts | xargs echo) | ||
6 | notificationsFiles=$(find server/tests/api/notifications -type f | grep -v index.ts | xargs echo) | ||
7 | searchFiles=$(find server/tests/api/search -type f | grep -v index.ts | xargs echo) | ||
8 | |||
9 | MOCHA_PARALLEL=true npm run mocha -- --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \ | ||
10 | $notificationsFiles $searchFiles $checkParamFiles | ||
diff --git a/server/tests/api/ci-2.sh b/server/tests/api/ci-2.sh deleted file mode 100644 index 016df1cfc..000000000 --- a/server/tests/api/ci-2.sh +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | set -eu | ||
4 | |||
5 | serverFiles=$(find server/tests/api/server -type f | grep -v index.ts | xargs echo) | ||
6 | usersFiles=$(find server/tests/api/users -type f | grep -v index.ts | xargs echo) | ||
7 | |||
8 | MOCHA_PARALLEL=true npm run mocha -- --parallel --jobs $1 --timeout 30000 --exit \ | ||
9 | --require ts-node/register --require tsconfig-paths/register --bail \ | ||
10 | $serverFiles $usersFiles | ||
diff --git a/server/tests/api/ci-3.sh b/server/tests/api/ci-3.sh deleted file mode 100644 index ae5bb735a..000000000 --- a/server/tests/api/ci-3.sh +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | set -eu | ||
4 | |||
5 | videosFiles=$(find server/tests/api/videos -type f | grep -v index.ts | xargs echo) | ||
6 | |||
7 | npm run mocha -- --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \ | ||
8 | $videosFiles | ||
diff --git a/server/tests/api/ci-4.sh b/server/tests/api/ci-4.sh deleted file mode 100644 index 4998de364..000000000 --- a/server/tests/api/ci-4.sh +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | set -eu | ||
4 | |||
5 | activitypubFiles=$(find server/tests/api/moderation -type f | grep -v index.ts | xargs echo) | ||
6 | redundancyFiles=$(find server/tests/api/redundancy -type f | grep -v index.ts | xargs echo) | ||
7 | activitypubFiles=$(find server/tests/api/activitypub -type f | grep -v index.ts | xargs echo) | ||
8 | |||
9 | TS_NODE_FILES=true MOCHA_PARALLEL=true npm run mocha -- --parallel --jobs $1 --timeout 30000 --exit \ | ||
10 | --require ts-node/register --require tsconfig-paths/register --bail \ | ||
11 | $redundancyFiles $activitypubFiles | ||