diff --git a/.travis.yml b/.travis.yml index 8b0fe2f95..115c1c8dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ before_install: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - sleep 3 + - . ./scripts/ci/job_hooks/before_install.sh stages: - name: Quality and Unit tests @@ -28,23 +29,35 @@ jobs: - stage: Quality and Unit tests name: 'Code quality checks' script: npm run lint - - name: 'Unit tests' + - name: 'Build' + script: npm run build + after_success: ./scripts/ci/utils/artifact-to-s3.sh -a ./dist/app -o "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" + - name: 'Unit tests aos' script: - - npm run test:ci + - ng test adf-office-services-ext --watch=false + - name: 'Unit tests ACA' + script: + - ng test app --code-coverage --watch=false - bash <(curl -s https://codecov.io/bash) -X gcov - stage: e2e name: Test Suite appNavigation&search - script: npm run build.e2e && SUITE="--suite authentication,listViews,navigation,application,pagination,search" npm run e2e:docker + before_script: ./scripts/ci/utils/artifact-from-s3.sh -a "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" -o "./dist/app" + script: SUITE="--suite authentication,listViews,navigation,application,pagination,search" npm run e2e:docker - name: Test Suite actionsAvailable - script: npm run build.e2e && SUITE="--suite actionsAvailable" npm run e2e:docker + before_script: ./scripts/ci/utils/artifact-from-s3.sh -a "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" -o "./dist/app" + script: SUITE="--suite actionsAvailable" npm run e2e:docker - name: Test Suite addRemoveContent - script: npm run build.e2e && SUITE="--suite addRemoveContent" npm run e2e:docker + before_script: ./scripts/ci/utils/artifact-from-s3.sh -a "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" -o "./dist/app" + script: SUITE="--suite addRemoveContent" npm run e2e:docker - name: Test Suite manageContent - script: npm run build.e2e && SUITE="--suite manageContent" npm run e2e:docker + before_script: ./scripts/ci/utils/artifact-from-s3.sh -a "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" -o "./dist/app" + script: SUITE="--suite manageContent" npm run e2e:docker - name: Test Suite sharingContent&markFavorite - script: npm run build.e2e && SUITE="--suite sharingContent" npm run e2e:docker + before_script: ./scripts/ci/utils/artifact-from-s3.sh -a "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" -o "./dist/app" + script: SUITE="--suite sharingContent" npm run e2e:docker - name: Test Suite viewContent&metadata&extensions - script: npm run build.e2e && SUITE="--suite viewer,infoDrawer,extensions" npm run e2e:docker + before_script: ./scripts/ci/utils/artifact-from-s3.sh -a "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" -o "./dist/app" + script: SUITE="--suite viewer,infoDrawer,extensions" npm run e2e:docker after_failure: - alfrescoContainerId=$(docker ps -a | grep 'alfresco-content-repository-community' | awk '{print $1}') diff --git a/package.json b/package.json index b34d419d4..2bfc12374 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build.aos": "npm run build:aos-extension", "build.extensions": "npm run build.shared && npm run build.aos", "build.app": "node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng build app", - "build": "npm run validate-config && npm run build.extensions && npm run build.app -- --prod", + "build": "npm run validate-config && npm run build.app -- --prod --configuration=e2e", "build.js-api": "./scripts/install-local-js-api.sh && npm run build", "build.adf": "./scripts/install-local-adf.sh && npm run build.extensions && npm run build.app", "build.e2e": "npm run build.extensions && npm run build.app -- --prod --configuration=e2e", diff --git a/scripts/ci/job_hooks/before_install.sh b/scripts/ci/job_hooks/before_install.sh new file mode 100755 index 000000000..f45c4dc39 --- /dev/null +++ b/scripts/ci/job_hooks/before_install.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +pip install --user awscli + +export NODE_OPTIONS="--max_old_space_size=30000" +export GIT_HASH=`git rev-parse HEAD` +S3_DBP_PATH="s3://alfresco-travis-builds/dbp" +export BASE_HASH="$(git describe --tags `git rev-list --tags --max-count=1`)" +export HEAD_HASH="HEAD" + +if [ "${TRAVIS_EVENT_TYPE}" == "push" ]; then + export S3_DBP_FOLDER="$S3_DBP_PATH/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID" +elif [ "${TRAVIS_EVENT_TYPE}" == "pull_request" ]; then + export S3_DBP_FOLDER="$S3_DBP_PATH/$TRAVIS_PULL_REQUEST/$TRAVIS_BUILD_ID" + export BASE_HASH="origin/$TRAVIS_BRANCH" +elif [ "${TRAVIS_EVENT_TYPE}" == "cron" ]; then + export S3_DBP_FOLDER="$S3_DBP_PATH/cron/$TRAVIS_BUILD_ID" +else + export S3_DBP_FOLDER="$S3_DBP_PATH/api/$TRAVIS_BUILD_ID" +fi + +echo "BASE_HASH: $BASE_HASH" +echo "S3 DBP destination: $S3_DBP_FOLDER" + +export DISPLAY=:99.0 +sh -e /etc/init.d/xvfb start +sleep 3 # give xvfb some time to start diff --git a/scripts/ci/utils/artifact-from-s3.sh b/scripts/ci/utils/artifact-from-s3.sh new file mode 100755 index 000000000..e73bec656 --- /dev/null +++ b/scripts/ci/utils/artifact-from-s3.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +show_help() { + echo "Usage: artifact-from-s3.sh " + echo "" + echo "-a or --artifact [mandatory]: path to the s3 artifact (tar.bz2) to download and extract" + echo "-o or --output [mandatory]: directory to extract the archive to" +} + +while [[ $1 == -* ]]; do + case "$1" in + -h|--help|-\?) show_help; exit 0;; + -a|--artifact) ARTIFACT=$2; shift 2;; + -o|--output) OUTPUT=$2; shift 2;; + -*) shift;; + esac +done + +if [ "${ARTIFACT}" == "" ] || [ "${OUTPUT}" == "" ] +then + show_help; + exit 1 +fi + +test ! -d $OUTPUT && mkdir -p $OUTPUT +aws s3 cp $ARTIFACT ./s3-artifact.tmp +tar -xvf ./s3-artifact.tmp -C $OUTPUT +rm ./s3-artifact.tmp diff --git a/scripts/ci/utils/artifact-to-s3.sh b/scripts/ci/utils/artifact-to-s3.sh new file mode 100755 index 000000000..523bb528d --- /dev/null +++ b/scripts/ci/utils/artifact-to-s3.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +show_help() { + echo "Usage: artifact-to-s3.sh " + echo "" + echo "-a or --artifact [mandatory]: path to the artifact to archieve (tar.bz2) and upload (like ./dist)" + echo "-o or --output [mandatory]: the S3 object to copy it to, like: s3://bucket-name/folder/whatever.tar.bz2" +} + +while [[ $1 == -* ]]; do + case "$1" in + -h|--help|-\?) show_help; exit 0;; + -a|--artifact) ARTIFACT=$2; shift 2;; + -o|--output) OUTPUT=$2; shift 2;; + -*) shift;; + esac +done + +if [ "${ARTIFACT}" == "" ] || [ "${OUTPUT}" == "" ] +then + show_help; + exit 1 +fi + +tar cvfj ./s3-artifact.tmp -C $ARTIFACT `ls $ARTIFACT` +aws s3 cp ./s3-artifact.tmp $OUTPUT +rm ./s3-artifact.tmp diff --git a/src/app/components/layout/layout.theme.scss b/src/app/components/layout/layout.theme.scss index 57005169e..c1b1bac25 100644 --- a/src/app/components/layout/layout.theme.scss +++ b/src/app/components/layout/layout.theme.scss @@ -1,5 +1,5 @@ @import './app-layout/app-layout.theme.scss'; -@import './../components/header/header.component.scss'; +@import '../header/header.component.scss'; @mixin layout-theme($theme) { @include app-layout-theme($theme); diff --git a/tsconfig.json b/tsconfig.json index cd195d804..efbb3580c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,10 +18,15 @@ "lib": ["es2018", "dom"], "paths": { "@alfresco/aca-shared": ["projects/aca-shared/src/public-api.ts"], - "@alfresco/aca-shared/store": ["projects/aca-shared/store/src/public_api.ts"], - "@alfresco/aca-shared/rules": ["projects/aca-shared/rules/src/public_api.ts"], - "@alfresco/adf-office-services-ext": ["projects/adf-office-services-ext/src/public_api.ts"], - "@alfresco/adf-office-services-ext/*": ["projects/adf-office-services-ext/src/lib/*"] + "@alfresco/aca-shared/store": [ + "projects/aca-shared/store/src/public_api.ts" + ], + "@alfresco/aca-shared/rules": [ + "projects/aca-shared/rules/src/public_api.ts" + ], + "@alfresco/adf-office-services-ext": [ + "projects/adf-office-services-ext/src/public_api.ts" + ] } }, "exclude": ["node_modules"],