Skip to content

Commit

Permalink
Run e2e only when lib affected (#7791)
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriziovitale committed Aug 26, 2022
1 parent c7d7695 commit 38e9cc9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 22 deletions.
34 changes: 17 additions & 17 deletions .travis.yml
Expand Up @@ -183,7 +183,7 @@ jobs:
- stage: "e2e Test"
name: "Process Cloud: Storybook Playwright"
before_script: ./scripts/ci/jobs/dbpci-before-playwright
script: ./scripts/travis/storybook-testing/storybook-test.sh
script: ./scripts/travis/affected-contains.sh "process-services-cloud" && ./scripts/travis/storybook-testing/storybook-test.sh
workspaces:
use:
- built_libs_cache
Expand All @@ -195,7 +195,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "core" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -216,7 +216,7 @@ jobs:
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "content-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -237,7 +237,7 @@ jobs:
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "content-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -258,7 +258,7 @@ jobs:
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "content-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -279,7 +279,7 @@ jobs:
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "content-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -300,7 +300,7 @@ jobs:
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "content-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -321,7 +321,7 @@ jobs:
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "content-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -343,7 +343,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-external-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "process-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -365,7 +365,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-external-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "process-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -387,7 +387,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-external-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "process-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -409,7 +409,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-external-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "process-services" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -431,7 +431,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "process-services-cloud" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -454,7 +454,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "process-services-cloud" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -477,7 +477,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "process-services-cloud" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -500,7 +500,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "process-services-cloud" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand All @@ -523,7 +523,7 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
script: ./scripts/travis/affected-contains.sh "process-services-cloud" && ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
create:
Expand Down
12 changes: 7 additions & 5 deletions nx.json
Expand Up @@ -2,11 +2,13 @@
"npmScope": "adf",
"implicitDependencies": {
"angular.json": "*",
"package.json": "*",
"tsconfig.json": "*",
"tslint.json": "*",
"nx.json": "*",
".travis.yml": "*",
"package.json": {
"dependencies": {
"@alfresco/*": "*",
"@angular/*": "*",
"rxjs": "*"
}
},
"demo-shell/src/index.html": "*",
"e2e/protractor.excludes.json": "*",
"e2e/protractor.conf.js": "*"
Expand Down
18 changes: 18 additions & 0 deletions scripts/travis/affected-contains.sh
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
verifyLib=$1;
cd $DIR/../../

AFFECTED_LIBS="$(nx print-affected --type=lib --select=projects --base=$BASE_HASH --head=$HEAD_HASH --plain || exit 1)"
echo "Verify if affected build contains $1"


echo "Affected libs:$AFFECTED_LIBS"
if [[ $AFFECTED_LIBS =~ $verifyLib ]]; then
echo "Yep project:$verifyLib is affected carry on"
exit 0
else
echo "Nope project NOT affected save time"
exit 1
fi;

0 comments on commit 38e9cc9

Please sign in to comment.