mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
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:
committed by
Eugenio Romano
parent
2fcec4f235
commit
f0dff4d011
49
scripts/affected-folder.sh
Executable file
49
scripts/affected-folder.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
eval BRANCH_NAME=""
|
||||
eval HEAD_SHA_BRANCH=""
|
||||
eval SHA_2="HEAD"
|
||||
|
||||
show_help() {
|
||||
echo "Usage: affected-folder.sh"
|
||||
echo ""
|
||||
echo "-b branch name"
|
||||
echo "-folder"
|
||||
}
|
||||
|
||||
branch_name(){
|
||||
BRANCH_NAME=$1
|
||||
}
|
||||
|
||||
folder_name(){
|
||||
FOLDER_NAME=$1
|
||||
}
|
||||
|
||||
while [[ $1 == -* ]]; do
|
||||
case "$1" in
|
||||
-b) branch_name $2; shift 2;;
|
||||
-f) folder_name $2; shift 2;;
|
||||
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$BRANCH_NAME" == "" ]]
|
||||
then
|
||||
echo "The branch name is mandatory"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$FOLDER_NAME" == "" ]]
|
||||
then
|
||||
echo "The folder name is mandatory"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
HEAD_SHA_BRANCH="$(git merge-base origin/$BRANCH_NAME HEAD)"
|
||||
#echo "Branch name $BRANCH_NAME HEAD sha " $HEAD_SHA_BRANCH
|
||||
|
||||
if git diff --name-only $HEAD_SHA_BRANCH HEAD | grep "^${FOLDER_NAME}" &> /dev/null
|
||||
then
|
||||
echo ${FOLDER_NAME}
|
||||
fi
|
||||
|
113
scripts/affected-libs.sh
Executable file
113
scripts/affected-libs.sh
Executable file
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
eval BRANCH_NAME=""
|
||||
eval HEAD_SHA_BRANCH=""
|
||||
eval SHA_2="HEAD"
|
||||
eval DIRECTORY="tmp"
|
||||
|
||||
show_help() {
|
||||
echo "Usage: smart-build.sh"
|
||||
echo ""
|
||||
echo "-b branch name"
|
||||
}
|
||||
|
||||
branch_name(){
|
||||
BRANCH_NAME=$1
|
||||
}
|
||||
|
||||
while [[ $1 == -* ]]; do
|
||||
case "$1" in
|
||||
-b) branch_name $2; shift 2;;
|
||||
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$BRANCH_NAME" == "" ]]
|
||||
then
|
||||
echo "The branch name is mandatory"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#HEAD_SHA_BRANCH=(`git merge-base origin/$BRANCH_NAME HEAD`)
|
||||
HEAD_SHA_BRANCH="$(git merge-base origin/$BRANCH_NAME HEAD)"
|
||||
echo "Branch name $BRANCH_NAME HEAD sha " $HEAD_SHA_BRANCH
|
||||
|
||||
# tmp folder doesn't exist.
|
||||
if [ ! -d "$DIRECTORY" ]; then
|
||||
#find affected libs
|
||||
echo "Directory tmp created";
|
||||
mkdir $DIRECTORY;
|
||||
fi
|
||||
|
||||
if [ ! -f $DIRECTORY/deps.txt ]; then
|
||||
npm run affected:libs -- $HEAD_SHA_BRANCH "HEAD" > $DIRECTORY/deps.txt
|
||||
fi
|
||||
|
||||
#echo "extensions" > deps.txt
|
||||
|
||||
#clean file
|
||||
sed -i '/^$/d' ./$DIRECTORY/deps.txt
|
||||
sed -i '/alfresco-components/d' ./$DIRECTORY/deps.txt
|
||||
sed -i '/nx affected:libs/d' ./$DIRECTORY/deps.txt
|
||||
sed -i '/^$/d' ./$DIRECTORY/deps.txt
|
||||
|
||||
#read result from file
|
||||
while IFS= read -r var
|
||||
do
|
||||
fileLine=$var
|
||||
done < "./$DIRECTORY/deps.txt"
|
||||
|
||||
#transform string to array
|
||||
libs=(`echo $fileLine | sed 's/^$/\n/g'`)
|
||||
|
||||
#core
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "core" ] ; then
|
||||
AFFECTED_LIBS="core$ content-services$ process-services$ process-services-cloud$ insights$ extensions$ "
|
||||
echo "${AFFECTED_LIBS}"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
#process-services
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "process-services" ] ; then
|
||||
AFFECTED_LIBS=$AFFECTED_LIBS" process-services$"
|
||||
fi
|
||||
done
|
||||
|
||||
#content-services
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "content-services" ] ; then
|
||||
AFFECTED_LIBS=$AFFECTED_LIBS" content-services$"
|
||||
fi
|
||||
done
|
||||
|
||||
#insights
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "insights" ] ; then
|
||||
AFFECTED_LIBS=$AFFECTED_LIBS" insights$"
|
||||
fi
|
||||
done
|
||||
|
||||
#extensions
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "extensions" ] ; then
|
||||
AFFECTED_LIBS=$AFFECTED_LIBS" extensions$"
|
||||
fi
|
||||
done
|
||||
|
||||
#process-services-cloud
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "process-services-cloud" ] ; then
|
||||
AFFECTED_LIBS=$AFFECTED_LIBS" process-services-cloud$"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${AFFECTED_LIBS}"
|
24
scripts/build-content-services.sh
Executable file
24
scripts/build-content-services.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
echo "====== Content Services ======"
|
||||
echo "====== Build ======"
|
||||
npm run ng-packagr -- -p ./lib/content-services/ || exit 1
|
||||
|
||||
echo "====== Build style ======"
|
||||
node ./lib/config/bundle-content-services-scss.js || exit 1
|
||||
|
||||
echo "====== Copy i18n ======"
|
||||
mkdir -p ./lib/dist/content-services/bundles/assets/adf-content-services/i18n
|
||||
cp -R ./lib/content-services/i18n/* ./lib/dist/content-services/bundles/assets/adf-content-services/i18n
|
||||
|
||||
echo "====== Copy assets ======"
|
||||
cp -R ./lib/content-services/assets/* ./lib/dist/content-services/bundles/assets
|
||||
|
||||
echo "====== Move to node_modules ======"
|
||||
rm -rf ./node_modules/@alfresco/adf-content-services/ && \
|
||||
mkdir -p ./node_modules/@alfresco/adf-content-services/ && \
|
||||
cp -R ./lib/dist/content-services/* ./node_modules/@alfresco/adf-content-services/
|
24
scripts/build-core.sh
Executable file
24
scripts/build-core.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
echo "====== Core ======"
|
||||
echo "====== Build ======"
|
||||
npm run ng-packagr -- -p ./lib/core/ || exit 1
|
||||
|
||||
echo "====== Build style ======"
|
||||
node ./lib/config/bundle-core-scss.js || exit 1
|
||||
|
||||
echo "====== Copy i18n ======"
|
||||
mkdir -p ./lib/dist/core/bundles/assets/adf-core/i18n
|
||||
cp -R ./lib/core/i18n/* ./lib/dist/core/bundles/assets/adf-core/i18n
|
||||
|
||||
echo "====== Copy assets ======"
|
||||
cp -R ./lib/core/assets/* ./lib/dist/core/bundles/assets
|
||||
|
||||
echo "====== Move to node_modules ======"
|
||||
rm -rf ./node_modules/@alfresco/adf-core/ && \
|
||||
mkdir -p ./node_modules/@alfresco/adf-core/ && \
|
||||
cp -R ./lib/dist/core/* ./node_modules/@alfresco/adf-core/
|
14
scripts/build-extensions.sh
Executable file
14
scripts/build-extensions.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
echo "====== Extensions ======"
|
||||
echo "====== Build ======"
|
||||
ng build extensions || exit 1
|
||||
|
||||
echo "====== Move to node_modules ======"
|
||||
rm -rf ./node_modules/@alfresco/adf-extensions/ && \
|
||||
mkdir -p ./node_modules/@alfresco/adf-extensions/ && \
|
||||
cp -R ./lib/dist/extensions/* ./node_modules/@alfresco/adf-extensions/
|
24
scripts/build-insights.sh
Executable file
24
scripts/build-insights.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
echo "====== Insights ======"
|
||||
echo "====== Build ======"
|
||||
npm run ng-packagr -- -p ./lib/insights/ || exit 1
|
||||
|
||||
echo "====== Build style ======"
|
||||
node ./lib/config/bundle-insights-scss.js || exit 1
|
||||
|
||||
echo "====== Copy i18n ======"
|
||||
mkdir -p ./lib/dist/insights/bundles/assets/adf-insights/i18n
|
||||
cp -R ./lib/insights/i18n/* ./lib/dist/insights/bundles/assets/adf-insights/i18n
|
||||
|
||||
echo "====== Copy assets ======"
|
||||
cp -R ./lib/insights/assets/* ./lib/dist/insights/bundles/assets
|
||||
|
||||
echo "====== Move to node_modules ======"
|
||||
rm -rf ./node_modules/@alfresco/adf-insights/ && \
|
||||
mkdir -p ./node_modules/@alfresco/adf-insights/ && \
|
||||
cp -R ./lib/dist/insights/* ./node_modules/@alfresco/adf-insights/
|
24
scripts/build-process-services-cloud.sh
Executable file
24
scripts/build-process-services-cloud.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
echo "====== Process Services Cloud ======"
|
||||
echo "====== Build ======"
|
||||
ng build process-services-cloud || exit 1
|
||||
|
||||
echo "====== Build style ======"
|
||||
node ./lib/config/bundle-process-services-cloud-scss.js || exit 1
|
||||
|
||||
echo "====== Copy i18n ======"
|
||||
mkdir -p ./lib/dist/process-services-cloud/bundles/assets/adf-process-services-cloud/i18n
|
||||
cp -R ./lib/process-services-cloud/src/lib/i18n/* ./lib/dist/process-services-cloud/bundles/assets/adf-process-services-cloud/i18n
|
||||
|
||||
echo "====== Copy assets ======"
|
||||
cp -R ./lib/process-services-cloud/src/lib/assets/* ./lib/dist/process-services-cloud/bundles/assets
|
||||
|
||||
echo "====== Move to node_modules ======"
|
||||
rm -rf ./node_modules/@alfresco/adf-process-services-cloud/ && \
|
||||
mkdir -p ./node_modules/@alfresco/adf-process-services-cloud/ && \
|
||||
cp -R ./lib/dist/process-services-cloud/* ./node_modules/@alfresco/adf-process-services-cloud/
|
24
scripts/build-process-services.sh
Executable file
24
scripts/build-process-services.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
echo "====== Process Services ======"
|
||||
echo "====== Build ======"
|
||||
npm run ng-packagr -- -p ./lib/process-services/ || exit 1
|
||||
|
||||
echo "====== Build style ======"
|
||||
node ./lib/config/bundle-process-services-scss.js || exit 1
|
||||
|
||||
echo "====== Copy i18n ======"
|
||||
mkdir -p ./lib/dist/process-services/bundles/assets/adf-process-services/i18n
|
||||
cp -R ./lib/process-services/i18n/* ./lib/dist/process-services/bundles/assets/adf-process-services/i18n
|
||||
|
||||
echo "====== Copy assets ======"
|
||||
cp -R ./lib/process-services/assets/* ./lib/dist/process-services/bundles/assets
|
||||
|
||||
echo "====== Move to node_modules ======"
|
||||
rm -rf ./node_modules/@alfresco/adf-process-services/ && \
|
||||
mkdir -p ./node_modules/@alfresco/adf-process-services/ && \
|
||||
cp -R ./lib/dist/process-services/* ./node_modules/@alfresco/adf-process-services/
|
52
scripts/smart-build.sh
Executable file
52
scripts/smart-build.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
affected="$(./scripts/affected-libs.sh -b "$TRAVIS_BRANCH")"
|
||||
libs=(`echo $affected | sed 's/^$/\n/g'`)
|
||||
|
||||
#core
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "core$" ] ; then
|
||||
./scripts/build-core.sh
|
||||
fi
|
||||
done
|
||||
|
||||
#content-services
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "content-services$" ] ; then
|
||||
./scripts/build-content-services.sh
|
||||
fi
|
||||
done
|
||||
|
||||
#process-services
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "process-services$" ] ; then
|
||||
./scripts/build-process-services.sh
|
||||
fi
|
||||
done
|
||||
|
||||
#process-services-cloud
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "process-services-cloud$" ] ; then
|
||||
./scripts/build-process-services-cloud.sh
|
||||
fi
|
||||
done
|
||||
|
||||
#insights
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "insights$" ] ; then
|
||||
./scripts/build-insights.sh
|
||||
fi
|
||||
done
|
||||
|
||||
#extensions
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "extensions$" ] ; then
|
||||
./scripts/build-extensions.sh
|
||||
fi
|
||||
done
|
Reference in New Issue
Block a user