From 18530063feb3326369bf3871248b04de0ce4d2af Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 31 Oct 2017 17:23:57 +0100 Subject: [PATCH] Try matrix to speed up travis builds --- .travis.yml | 11 ++++++++++- client/config/webpack.prod.js | 2 +- client/package.json | 2 +- package.json | 3 ++- scripts/build/client.sh | 4 ++-- scripts/test.sh | 12 +++++------- scripts/travis.sh | 23 +++++++++++++++++++++++ 7 files changed, 44 insertions(+), 13 deletions(-) create mode 100755 scripts/travis.sh diff --git a/.travis.yml b/.travis.yml index 7b8935a32..1b611b402 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,6 @@ services: - postgresql before_script: - - npm run build - wget --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-3.0.2-64bit-static.tar.xz" - tar xf ffmpeg-release-3.0.2-64bit-static.tar.xz - mkdir -p $HOME/bin @@ -37,6 +36,16 @@ before_script: - psql -c 'create database peertube_test6;' -U postgres - psql -c "create user peertube with password 'peertube';" -U postgres +matrix: + include: + - env: TEST_SUITE=build_then_client + - env: TEST_SUITE=api + - env: TEST_SUITE=cli + - env: TEST_SUITE=lint + +script: + - npm run travis -- "$TEST_SUITE" + after_failure: - cat test1/logs/all-logs.log - cat test2/logs/all-logs.log diff --git a/client/config/webpack.prod.js b/client/config/webpack.prod.js index ecd7914c7..539b9a1ee 100644 --- a/client/config/webpack.prod.js +++ b/client/config/webpack.prod.js @@ -167,7 +167,7 @@ module.exports = function (env) { beautify: false } }, - warnings: true + warningsFilter: () => false }), /** diff --git a/client/package.json b/client/package.json index 1715416cf..39b3185cc 100644 --- a/client/package.json +++ b/client/package.json @@ -13,7 +13,7 @@ "url": "git://github.com/Chocobozzz/PeerTube.git" }, "scripts": { - "test": "standard && tslint --type-check --project ./tsconfig.json -c ./tslint.json 'src/app/**/*.ts'", + "lint": "standard && tslint --type-check --project ./tsconfig.json -c ./tslint.json 'src/app/**/*.ts'", "webpack": "webpack", "webpack-dev-server": "webpack-dev-server", "postinstall": "npm rebuild node-sass" diff --git a/package.json b/package.json index ef044ab16..fd878a342 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "tsc": "tsc", "nodemon": "nodemon", "ts-node": "ts-node", - "tslint": "tslint" + "tslint": "tslint", + "travis": "scripty" }, "dependencies": { "async": "^2.0.0", diff --git a/scripts/build/client.sh b/scripts/build/client.sh index 65b67edcf..3a1532daf 100755 --- a/scripts/build/client.sh +++ b/scripts/build/client.sh @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/bash cd client || exit -1 -rm -rf ./compiled +rm -rf ./compiled ./dist npm run webpack -- --config config/webpack.prod.js --progress --profile --bail diff --git a/scripts/test.sh b/scripts/test.sh index dc1baf97d..473445876 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,10 +1,8 @@ #!/bin/bash -npm run build:server +npm run build:server || exit -1 -cd client || exit -1 -npm test || exit -1 - -cd .. || exit -1 -npm run tslint -- --type-check --project ./tsconfig.json -c ./tslint.json server.ts "server/**/*.ts" || exit -1 -mocha --exit --require ts-node/register --bail server/tests/index.ts +npm run travis -- client || exit -1 +npm run travis -- api || exit -1 +npm run travis -- cli || exit -1 +npm run travis -- lint || exit -1 diff --git a/scripts/travis.sh b/scripts/travis.sh new file mode 100755 index 000000000..e919f18a4 --- /dev/null +++ b/scripts/travis.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + echo "Need test suite argument." + exit -1 +fi + +if [ "$1" = "build_then_client" ]; then + npm run build + mocha --exit --require ts-node/register --bail server/tests/client.ts +elif [ "$1" = "client" ]; then + mocha --exit --require ts-node/register --bail server/tests/client.ts +elif [ "$1" = "api" ]; then + mocha --exit --require ts-node/register --bail server/tests/api/index.ts +elif [ "$1" = "cli" ]; then + mocha --exit --require ts-node/register --bail server/tests/cli/index.ts +elif [ "$1" = "lint" ]; then + cd client || exit -1 + npm run lint || exit -1 + + cd .. || exit -1 + npm run tslint -- --type-check --project ./tsconfig.json -c ./tslint.json server.ts "server/**/*.ts" || exit -1 +fi