diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-17 10:43:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-17 10:43:34 +0200 |
commit | 29b7426c671c91b8567b038df30b9ae909ee838a (patch) | |
tree | df0b8473eee01e60326f824b49307dbbe039f8a2 | |
parent | 609a444202b4cf97f962ed596aac4d0d7b7f63fe (diff) | |
download | PeerTube-29b7426c671c91b8567b038df30b9ae909ee838a.tar.gz PeerTube-29b7426c671c91b8567b038df30b9ae909ee838a.tar.zst PeerTube-29b7426c671c91b8567b038df30b9ae909ee838a.zip |
Speedup CI
-rw-r--r-- | .github/workflows/test.yml | 2 | ||||
-rwxr-xr-x | scripts/build/client.sh | 2 | ||||
-rwxr-xr-x | scripts/ci.sh | 19 | ||||
-rwxr-xr-x | scripts/test.sh | 4 | ||||
-rw-r--r-- | server/tests/plugins/html-injection.ts | 2 |
5 files changed, 19 insertions, 10 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1edde1ef..46b243244 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml | |||
@@ -39,7 +39,7 @@ jobs: | |||
39 | strategy: | 39 | strategy: |
40 | fail-fast: false | 40 | fail-fast: false |
41 | matrix: | 41 | matrix: |
42 | test_suite: [ misc, api-1, api-2, api-3, api-4, cli, lint, external-plugins ] | 42 | test_suite: [ client, api-1, api-2, api-3, api-4, cli-plugin, lint, external-plugins ] |
43 | 43 | ||
44 | env: | 44 | env: |
45 | PGUSER: peertube | 45 | PGUSER: peertube |
diff --git a/scripts/build/client.sh b/scripts/build/client.sh index 91147fc51..0b7cbec35 100755 --- a/scripts/build/client.sh +++ b/scripts/build/client.sh | |||
@@ -40,7 +40,7 @@ languages=( | |||
40 | 40 | ||
41 | cd client | 41 | cd client |
42 | 42 | ||
43 | rm -rf ./dist ./compiled | 43 | rm -rf ./dist |
44 | 44 | ||
45 | # Don't build other languages if --light arg is provided | 45 | # Don't build other languages if --light arg is provided |
46 | if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); then | 46 | if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); then |
diff --git a/scripts/ci.sh b/scripts/ci.sh index b068deeb4..07e37e0ee 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh | |||
@@ -33,24 +33,33 @@ runTest () { | |||
33 | } | 33 | } |
34 | 34 | ||
35 | findTestFiles () { | 35 | findTestFiles () { |
36 | find $1 -type f -name "*.js" | grep -v "/index.js" | 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 ./dist/server/tests/feeds) | 48 | feedsFiles=$(findTestFiles ./dist/server/tests/feeds) |
43 | helperFiles=$(findTestFiles ./dist/server/tests/helpers) | 49 | helperFiles=$(findTestFiles ./dist/server/tests/helpers) |
44 | pluginsFiles=$(findTestFiles ./dist/server/tests/plugins) | ||
45 | miscFiles="./dist/server/tests/client.js ./dist/server/tests/misc-endpoints.js" | 50 | miscFiles="./dist/server/tests/client.js ./dist/server/tests/misc-endpoints.js" |
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 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 | ||
59 | pluginsFiles=$(findTestFiles ./dist/server/tests/plugins html-injection.js) | ||
52 | cliFiles=$(findTestFiles ./dist/server/tests/cli) | 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 |
diff --git a/scripts/test.sh b/scripts/test.sh index 32034531d..01b259fe2 100755 --- a/scripts/test.sh +++ b/scripts/test.sh | |||
@@ -7,8 +7,8 @@ npm run setup:cli | |||
7 | 7 | ||
8 | npm run ci -- lint | 8 | npm run ci -- lint |
9 | 9 | ||
10 | npm run ci -- misc | 10 | npm run ci -- client |
11 | npm run ci -- cli | 11 | npm run ci -- cli-plugin |
12 | npm run ci -- api-1 | 12 | npm run ci -- api-1 |
13 | npm run ci -- api-2 | 13 | npm run ci -- api-2 |
14 | npm run ci -- api-3 | 14 | npm run ci -- api-3 |
diff --git a/server/tests/plugins/html-injection.ts b/server/tests/plugins/html-injection.ts index 293c1df21..4fa8caa3a 100644 --- a/server/tests/plugins/html-injection.ts +++ b/server/tests/plugins/html-injection.ts | |||
@@ -15,7 +15,7 @@ import { | |||
15 | 15 | ||
16 | const expect = chai.expect | 16 | const expect = chai.expect |
17 | 17 | ||
18 | describe('Test plugins HTML inection', function () { | 18 | describe('Test plugins HTML injection', function () { |
19 | let server: ServerInfo = null | 19 | let server: ServerInfo = null |
20 | 20 | ||
21 | before(async function () { | 21 | before(async function () { |