From 0e153c47ef1f98aaabdfee7de2e30db1b8f8be69 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Mon, 22 May 2017 14:02:58 +0100 Subject: [PATCH] group test (#1890) --- .travis.yml | 12 ++++++---- scripts/README.md | 2 +- scripts/npm-build-all.sh | 49 ++++++++++++++++++++++++++++------------ scripts/npm-publish.sh | 9 ++++---- 4 files changed, 49 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5fa7fadaf3..c293925d1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,12 @@ before_install: env: matrix: - - MODULE=ng2-components + - MODULE=ng2-components-alfresco + - MODULE=ng2-components-activiti - MODULE=ng2-demo-shell install: - - if ([ "$MODULE" == "ng2-components" ]); then + - if ([ "$MODULE" == "ng2-components-alfresco" -o "$MODULE" == "ng2-components-activiti" ]); then if ([ "$TRAVIS_BRANCH" = "master" ]); then (./scripts/npm-build-all.sh || exit 1;); else @@ -23,8 +24,11 @@ install: fi script: - - if ([ "$MODULE" == "ng2-components" ]); then - (./scripts/npm-build-all.sh -si -sb -t || exit 1;); + - if ([ "$MODULE" == "ng2-components-activiti" ]); then + (./scripts/npm-build-all.sh -si -sb -t "ng2-activiti*" || exit 1;); + fi + - if ([ "$MODULE" == "ng2-components-alfresco" ]); then + (./scripts/npm-build-all.sh -si -sb -t "ng2-alfresco*" || exit 1;); fi - if ([ "$MODULE" == "ng2-demo-shell" ]); then if ([ "$TRAVIS_BRANCH" = "master" ]); then diff --git a/scripts/README.md b/scripts/README.md index 2364589cf3..1499321e95 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -144,7 +144,7 @@ The default behaviour of the ***npm-build-all.sh*** install node_modules and bui | Option | Description | | --- | --- | | -h or --help | show the help | -| -t or --test | If you want run the test: | +| -t or --test | If you want run the test, this parameter accept also a wildecard to execute test for example -t "ng2-alfresco-core" | | -c or --clean | clean the ng2_components folders before to start from all the temp builds file as node_modules | | -gitjsapi | if you want start the demo shell using an alfresco-js-api referenced by commit-ish version of the JS-API | | -si or --skipinstall | skip the install of the node_modules | diff --git a/scripts/npm-build-all.sh b/scripts/npm-build-all.sh index dcb2da8f6b..c5c390f39f 100755 --- a/scripts/npm-build-all.sh +++ b/scripts/npm-build-all.sh @@ -6,8 +6,10 @@ eval EXEC_FAST_TEST=false eval EXEC_CLEAN=false eval EXEC_BUILD=true eval EXEC_INSTALL=true +eval EXEC_SINGLE_TEST=false eval EXEC_GIT_NPM_INSTALL_JSAPI=false eval GIT_ISH="" +eval SINGLE_TEST="" eval projects=( "ng2-alfresco-core" "ng2-alfresco-datatable" @@ -30,7 +32,7 @@ eval projects=( "ng2-alfresco-core" show_help() { echo "Usage: npm-build-all.sh" echo "" - echo "-t or -test build all your local component and run also the test on them" + echo "-t or -test build all your local component and run also the test on them , this parameter accept also a wildecard to execute test for example -t "ng2-alfresco-core" " echo "-c or -clean the node_modules folder before to start the build" echo "-si or -skipinstall skip the install node_modules folder before to start the build" echo "-sb or skip build" @@ -39,6 +41,12 @@ show_help() { } enable_test(){ + if [[ ! -z $1 ]]; then + if [[ $1 != "-"* ]]; then + EXEC_SINGLE_TEST=true + SINGLE_TEST=$1 + fi + fi RUN_TEST=true } @@ -71,7 +79,12 @@ exec_install(){ while [[ $1 == -* ]]; do case "$1" in -h|--help|-\?) show_help; exit 0;; - -t|--test) enable_test; shift;; + -t|--test) enable_test $2; + shift; + if $EXEC_SINGLE_TEST == true; then + shift; + fi + ;; -ft|--fasttest) enable_fast_test; shift;; -gitjsapi) enable_js_api_git_link $2; shift 2;; -c|--clean) clean; shift;; @@ -89,11 +102,10 @@ if $EXEC_CLEAN == true; then npm run clean fi -echo "====== Regenerate global ng2-components package.json =====" -npm install package-json-merge -npm run pkg-build - if $EXEC_INSTALL == true; then + echo "====== Regenerate global ng2-components package.json =====" + npm install package-json-merge + npm run pkg-build echo "====== Install ng2-components dependencies =====" npm install fi @@ -116,11 +128,20 @@ if $EXEC_FAST_TEST == true; then npm run test || exit 1 fi -for PACKAGE in ${projects[@]} -do - DESTDIR="$DIR/../ng2-components/" - cd $DESTDIR - if $RUN_TEST == true; then - test_project $PACKAGE - fi -done + +if $RUN_TEST == true; then + for PACKAGE in ${projects[@]} + do + DESTDIR="$DIR/../ng2-components/" + cd $DESTDIR + if $EXEC_SINGLE_TEST == true; then + if [[ $PACKAGE == $SINGLE_TEST ]]; then + test_project $SINGLE_TEST + fi + else + test_project $PACKAGE + fi + done +fi + + diff --git a/scripts/npm-publish.sh b/scripts/npm-publish.sh index ae964258a8..927e9ad92f 100755 --- a/scripts/npm-publish.sh +++ b/scripts/npm-publish.sh @@ -106,6 +106,11 @@ do DESTDIR="$DIR/../ng2-components/${PACKAGE}" echo "====== MOVE DIR: ${DESTDIR} ===== " cd ${DESTDIR} + + if $EXEC_CHANGE_REGISTRY == true; then + change_registry + fi + echo "====== INSTALL AND CLEAN ${PACKAGE} ===== " npm install rimraf npm run clean @@ -119,10 +124,6 @@ do cd ${DESTDIR} fi - if $EXEC_CHANGE_REGISTRY == true; then - change_registry - fi - echo "====== PUBLISHING: ${DESTDIR} ===== npm publish ${OPTIONS}" npm publish ${OPTIONS} || exit 1