Travis cache (#3972)

* Use name instead of env

* Enable cache dist

* enable only master and dev

* rename e2e lib

* add nx and smart build

* disable packaging and create demo shell stages

* use same name

* Enable affected e2e for core and process

* Enable affected libs check on all the e2e

* fix e2e condition

* Enable unit tests

* Manage case deps not present

* add name typo

* add affected folder to check e2e

* change an e2e test

* remove branch typo

* Update .travis.yml
This commit is contained in:
Maurizio Vitale
2018-11-19 13:28:02 +00:00
committed by Eugenio Romano
parent 2fcec4f235
commit f0dff4d011
21 changed files with 864 additions and 204 deletions
+111 -68
View File
@@ -5,6 +5,21 @@ node_js:
# Use the explicit NodeJS LTS version 8.9.4 to avoid any automatic upgrade of the version.
- '8.9.4'
branches:
only:
- master
- development
stages:
- name: Warm Up Cache
if: branch = master
- name: Warm Up Cache & Lint & Build Dist
if: branch != master
- name: Unit test
- name: e2e Test
- name: Create Docker PR
- name: Deploy Docker PR
addons:
chrome: stable
before_script:
@@ -25,42 +40,71 @@ branches:
jobs:
include:
- stage: Warm Up Cache
script: if ([ "$TRAVIS_BRANCH" = "master" ]); then
(./scripts/npm-build-all.sh || exit 1;);
else
(./scripts/update-version.sh -gnu -alpha && ././scripts/npm-build-all.sh -sb --skip-lint || exit 1;);
fi
- stage: Lint
script:
- ./scripts/lint.sh
- npm run spellcheck
- ./scripts/npm-build-all.sh || exit 1
- stage: Warm Up Cache & Lint & Build Dist
script:
- ./scripts/update-version.sh -gnu -alpha || exit 1
- npm install
- ./scripts/lint.sh || exit 1
- npm run spellcheck || exit 1
- rm -rf tmp && (./scripts/smart-build.sh || exit 1;);
- npm run build:dist || exit 1
- stage: Unit test
env: STAGE=core
script: (./scripts/npm-build-all.sh -si -sb -t "core" --skip-lint || exit 1;);
name: core
script:
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "core$" ]];
then
ng test core --watch=false || exit 1;
fi
- stage: Unit test
env: STAGE=extensions
script: (./scripts/npm-build-all.sh -si -sb -t "extensions" --skip-lint || exit 1;);
name: extensions
script:
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "extensions$" ]];
then
ng test extensions --watch=false || exit 1;
fi
- stage: Unit test
env: STAGE=process-services
script: (./scripts/npm-build-all.sh -si -sb -t "process-services" --skip-lint|| exit 1;);
name: process-services
script:
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "process-services$" ]];
then
ng test process-services --watch=false || exit 1;
fi
- stage: Unit test
env: STAGE=insights
script: (./scripts/npm-build-all.sh -si -sb -t "insights" --skip-lint || exit 1;);
name: insights
script:
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "insights$" ]];
then
ng test insights --watch=false || exit 1;
fi
- stage: Unit test
env: STAGE=content-services
script: (./scripts/npm-build-all.sh -si -sb -t "content-services" --skip-lint|| exit 1;);
name: content-services
script:
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "content-services$" ]];
then
ng test content-services --watch=false || exit 1;
fi
- stage: Unit test
env: STAGE=process-services-cloud
script: (./scripts/npm-build-all.sh -si -sb -t "process-services-cloud" --skip-lint|| exit 1;);
name: process-services-cloud
script:
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "process-services-cloud$" ]];
then
ng test process-services-cloud --watch=false || exit 1;
fi
- stage: Unit test
env: STAGE=demo-shell
name: demo-shell
script: if ([ "$TRAVIS_BRANCH" = "master" ]); then
(./scripts/start.sh -t -ss || exit 1;);
else
(./scripts/start.sh -dev -t -ss -vjsapi alpha || exit 1;);
fi
- stage: Packaging test
script: (npm run build-lib || exit 1;) && node ./scripts/upload-build-lib-in-cs.js -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --host "$E2E_HOST" -f $TRAVIS_BUILD_NUMBER
- stage: Update children projects dependency #Update generator-ng2-alfresco-app
if: tag =~ .*beta.*
script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n generator-ng2-alfresco-app
@@ -76,59 +120,56 @@ jobs:
- stage: Update children projects dependency # Test Update alfresco-modeler-app
if: tag =~ .*beta.*
script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n alfresco-modeler-app
- stage: Create Shell dist
script: rm -rf ./node_modules/@alfresco; node ./scripts/download-build-lib-in-cs.js -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --host "$E2E_HOST" -f $TRAVIS_BUILD_NUMBER || exit 1; npm run build:dist || exit 1; node ./scripts/upload-build-in-cs.js -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --host "$E2E_HOST" -f $TRAVIS_BUILD_NUMBER || exit 1
- stage: e2e Test # Test core
env: STAGE=core
script: node ./scripts/download-build-in-cs.js --username "$E2E_USERNAME" --password "$E2E_PASSWORD" --host "$E2E_HOST" --folder $TRAVIS_BUILD_NUMBER; ./scripts/test-e2e-lib.sh -host localhost:4200 --host_sso "$E2E_HOST_SSO" -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder core --skip-lint --use-dist --timeout 7000
name: core
script:
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")";
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "core$" || $AFFECTED_E2E = "e2e" ]];
then
(./scripts/test-e2e-lib.sh -host localhost:4200 --host_sso "$E2E_HOST_SSO" -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder core --skip-lint --use-dist --timeout 7000 || exit 1;);
fi
- stage: e2e Test # Test process-services
env: STAGE=process-services
script: node ./scripts/download-build-in-cs.js --username "$E2E_USERNAME" --password "$E2E_PASSWORD" --host "$E2E_HOST" --folder $TRAVIS_BUILD_NUMBER; ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder process-services --skip-lint --use-dist --timeout 7000
name: process-services
script:
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")";
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "process-services$" || $AFFECTED_E2E = "e2e" ]];
then
(./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder process-services --skip-lint --use-dist --timeout 7000 || exit 1;);
fi
- stage: e2e Test # Test content-services
env: STAGE=content-services
script: node ./scripts/download-build-in-cs.js --username "$E2E_USERNAME" --password "$E2E_PASSWORD" --host "$E2E_HOST" --folder $TRAVIS_BUILD_NUMBER; ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder content-services --skip-lint --use-dist --timeout 7000
- stage: e2e Test # Test process-services
env: STAGE=process-services-cloud
script: node ./scripts/download-build-in-cs.js --username "$E2E_USERNAME" --password "$E2E_PASSWORD" --host "$E2E_HOST" --folder $TRAVIS_BUILD_NUMBER; ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder process-services-cloud --skip-lint --use-dist --timeout 7000
name: content-services
script:
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")";
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "content-services$" || $AFFECTED_E2E = "e2e" ]];
then
(./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder content-services --skip-lint --use-dist --timeout 7000 || exit 1;);
fi
- stage: e2e Test # Test process-services-cloud
name: process-services-cloud
script:
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")";
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "process-services-cloud$" || $AFFECTED_E2E = "e2e" ]];
then
(./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder process-services-cloud --skip-lint --use-dist --timeout 7000 || exit 1;);
fi
- stage: e2e Test # Test insights
env: STAGE=insights
script: node ./scripts/download-build-in-cs.js --username "$E2E_USERNAME" --password "$E2E_PASSWORD" --host "$E2E_HOST" --folder $TRAVIS_BUILD_NUMBER; ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder insights --skip-lint --use-dist --timeout 7000
# - stage: Test Update version 2.0.0
# if: branch = development
# env: STAGE=test-BC
# script: ./scripts/test-e2e-bc.sh -b $TRAVIS_BUILD_NUMBER
# - stage: Test Update version 2.0.0
# env: STAGE=test-export
# script: npm run test-export
name: insights
script:
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")";
AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "process-services-cloud$" || $AFFECTED_E2E = "e2e" ]];
then
(./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b -save --folder insights --skip-lint --use-dist --timeout 7000 || exit 1;);
fi
- stage: Create Docker PR
script: node ./scripts/download-build-in-cs.js --username "$E2E_USERNAME" --password "$E2E_PASSWORD" --host "$E2E_HOST" --folder $TRAVIS_BUILD_NUMBER --base-href $TRAVIS_BUILD_NUMBER && (./scripts/pr-publish.sh -n $TRAVIS_BUILD_NUMBER -r $REPO_DOCKER -u $USERNAME_DOCKER -p $PASSWORD_DOCKER || exit 1)
script: (./scripts/pr-publish.sh -n $TRAVIS_BUILD_NUMBER -r $REPO_DOCKER -u $USERNAME_DOCKER -p $PASSWORD_DOCKER || exit 1)
- stage: Deploy Docker PR
script: node --no-deprecation ./scripts/pr-deploy.js -n $TRAVIS_BUILD_NUMBER -u $RANCHER_TOKEN -p $RANCHER_SECRET -s $REPO_RANCHER --image "docker:$REPO_DOCKER/adf/demo-shell:$TRAVIS_BUILD_NUMBER" --env $ENVIRONMENT_NAME -r $ENVIRONMENT_URL || exit 1
# jobs:
# include:
# - stage: Publish alpha to NPM
# before_install: skip
# install: skip
# script: skip
# deploy:
# provider: script
# script: (./scripts/update-version.sh -v $(./scripts/next_version.sh)-$(git rev-parse HEAD) -vj $(npm view alfresco-js-api@alpha version) -gnu) && (./scripts/npm-publish.sh -r $NPM_REGISTRY_ADDRESS -token $NPM_REGISTRY_TOKEN -t alpha --sleep 20 || exit 1;);
# on:
# branch: development
# skip_cleanup: true
# - stage: Publish beta to NPM
# before_install: skip
# install: skip
# script: skip
# deploy:
# provider: script
# script: (./scripts/update-version.sh -v $TRAVIS_TAG -gnu) && (./scripts/npm-publish.sh -r $NPM_REGISTRY_ADDRESS -token $NPM_REGISTRY_TOKEN -t beta --sleep 20 || exit 1;);
# on:
# tags: true
# skip_cleanup: true
# Send coverage data to codecov
after_success:
bash <(curl -s https://codecov.io/bash) -X gcov
@@ -137,3 +178,5 @@ after_success:
cache:
directories:
- node_modules
- demo-shell/dist
- tmp