From 352388832ded85b09fadb515d03dd9b868de28e0 Mon Sep 17 00:00:00 2001 From: David Edwards Date: Mon, 20 Apr 2020 16:10:32 +0100 Subject: [PATCH] ATS-724 Parallel Travis builds (#223) * Split Build and test into separate jobs. --- .travis.yml | 57 +++++++++++----- _ci/build.sh | 17 ++--- _ci/test.sh | 26 ++++++++ alfresco-transformer-base/pom.xml | 11 ++++ pom.xml | 105 +++++++++++++++++++++++++----- 5 files changed, 171 insertions(+), 45 deletions(-) mode change 100644 => 100755 _ci/build.sh create mode 100755 _ci/test.sh diff --git a/.travis.yml b/.travis.yml index 2aee1c3c..b3f79ee3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,36 +24,60 @@ branches: - /^ATS-.*$/ stages: - - build + - build and test - release - company_release +before_install: bash _ci/init.sh + jobs: include: - - name: "Build + Tests" - stage: build - if: branch NOT IN (company_release) - before_install: bash _ci/init.sh + - stage: Build and Test + name: "Core & Base Snapshot deployment" # This is to separate the snapshot deployment from the following jobs, to prevent duplication on nexus + if: branch = master AND type != pull_request before_script: travis_wait bash _ci/cache_artifacts.sh - script: bash _ci/build.sh - + install: travis_wait 20 mvn -B -U -q clean install -DadditionalOption=-Xdoclint:none -DskipTests -Dmaven.javadoc.skip=true -Pbase + script: mvn -B -U clean deploy -DadditionalOption=-Xdoclint:none -Dmaven.javadoc.skip=true -Pbase + - name: "ImageMagick" + if: branch NOT IN (company_release) + before_script: travis_wait bash _ci/cache_artifacts.sh + install: _ci/build.sh imagemagick + script: bash _ci/test.sh imagemagick + - name: "LibreOffice" + if: branch NOT IN (company_release) + before_script: travis_wait bash _ci/cache_artifacts.sh + install: _ci/build.sh libreoffice + script: bash _ci/test.sh libreoffice + - name: "Transform Misc" + if: branch NOT IN (company_release) + before_script: travis_wait bash _ci/cache_artifacts.sh + install: _ci/build.sh misc + script: bash _ci/test.sh misc + - name: "PDF Renderer" + if: branch NOT IN (company_release) + before_script: travis_wait bash _ci/cache_artifacts.sh + install: _ci/build.sh pdf-renderer + script: bash _ci/test.sh pdf-renderer + - name: "Tika" + if: branch NOT IN (company_release) + before_script: travis_wait bash _ci/cache_artifacts.sh + install: _ci/build.sh tika + script: bash _ci/test.sh tika + - name: "All in One Transfomer" + if: branch NOT IN (company_release) + before_script: travis_wait bash _ci/cache_artifacts.sh + install: _ci/build.sh full-build + script: bash _ci/test.sh aio-test - name: "WhiteSource" - stage: build if: branch NOT IN (company_release) - before_install: bash _ci/init.sh script: bash _ci/whitesource.sh - - name: "Source Clear Scan (SCA)" - stage: build if: branch NOT IN (company_release) - before_install: bash _ci/init.sh install: skip script: travis_wait 30 bash _ci/sourceclear.sh - - name: "Static Analysis (SAST)" - stage: build -## TODO ATS-721: comment out until it is possible to run concurrent SAST scans -# if: branch NOT IN (company_release) AND type != pull_request +# TODO ATS-721: comment out until it is possible to run concurrent SAST scans +# if: branch NOT IN (company_release) AND type != pull_request if: branch = master AND type != pull_request before_install: - bash _ci/static_analysis_init.sh @@ -63,7 +87,6 @@ jobs: - name: "Release" stage: release if: commit_message ~= /\[trigger release\]/ AND branch ~= /^(master|SP\/.+|HF\/.+)$/ - before_install: bash _ci/init.sh before_script: travis_wait bash _ci/cache_artifacts.sh script: travis_wait 55 bash _ci/release.sh before_deploy: source _ci/prepare_staging_deploy.sh diff --git a/_ci/build.sh b/_ci/build.sh old mode 100644 new mode 100755 index 0c9c18f9..9bf63b36 --- a/_ci/build.sh +++ b/_ci/build.sh @@ -1,24 +1,17 @@ #!/usr/bin/env bash -echo "=========================== Starting Build&Test Script ===========================" +echo "=========================== Starting Build Script ===========================" PS4="\[\e[35m\]+ \[\e[m\]" set -vex pushd "$(dirname "${BASH_SOURCE[0]}")/../" -# Always build the image, but only publish from the "master" branch -[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && PROFILE="internal" || PROFILE="local" - -# If the branch is "master" and the commit is not a Pull Request then deploy the JAR SNAPSHOT artifacts -[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && DEPLOY="deploy" || DEPLOY="install" - mvn -B -U \ - clean ${DEPLOY} \ + clean install \ -DadditionalOption=-Xdoclint:none -Dmaven.javadoc.skip=true \ - "-P${PROFILE},docker-it-setup" - -docker ps -a -q | xargs -r -l docker stop ; docker ps -a -q | xargs -r -l docker rm + -DskipTests \ + "-P$1," popd set +vex -echo "=========================== Finishing Build&Test Script ==========================" +echo "=========================== Finishing Build Script ==========================" diff --git a/_ci/test.sh b/_ci/test.sh new file mode 100755 index 00000000..8550a2fb --- /dev/null +++ b/_ci/test.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +echo "=========================== Starting Test&Deploy Script ===========================" +PS4="\[\e[35m\]+ \[\e[m\]" +set -vex +pushd "$(dirname "${BASH_SOURCE[0]}")/../" + +# Always build the image, but only publish from the "master" branch +[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && PROFILE="internal" || PROFILE="local" + +# If the branch is "master" and the commit is not a Pull Request then deploy the JAR SNAPSHOT artifacts +[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && DEPLOY="deploy" || DEPLOY="test" + +# Do not deploy snapshots for alfresco-transform-core and alfresco-transformer-base +mvn -B -U \ + clean ${DEPLOY} \ + -DadditionalOption=-Xdoclint:none -Dmaven.javadoc.skip=true \ + -Dparent.core.deploy.skip=true -Dtransformer.base.deploy.skip=true \ + "-P${PROFILE},docker-it-setup,${1}" + +docker ps -a -q | xargs -r -l docker stop ; docker ps -a -q | xargs -r -l docker rm + +popd +set +vex +echo "=========================== Finishing Test&Deploy Script ==========================" + diff --git a/alfresco-transformer-base/pom.xml b/alfresco-transformer-base/pom.xml index 4e6a0804..1e22e65e 100644 --- a/alfresco-transformer-base/pom.xml +++ b/alfresco-transformer-base/pom.xml @@ -11,6 +11,10 @@ alfresco-transformer-base 2.2.0-A5-SNAPSHOT + + false + + org.springframework.boot @@ -81,6 +85,13 @@ + + org.apache.maven.plugins + maven-deploy-plugin + + ${transformer.base.deploy.skip} + + diff --git a/pom.xml b/pom.xml index d195fc5c..d0306f8a 100644 --- a/pom.xml +++ b/pom.xml @@ -28,24 +28,89 @@ 2.10.3 3.3.5 4.1.1 + + false - - alfresco-transformer-base - alfresco-transform-tika/alfresco-transform-tika - alfresco-transform-tika/alfresco-transform-tika-boot - alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer - alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer-boot - alfresco-transform-libreoffice/alfresco-transform-libreoffice - alfresco-transform-libreoffice/alfresco-transform-libreoffice-boot - alfresco-transform-imagemagick/alfresco-transform-imagemagick - alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot - alfresco-transform-misc/alfresco-transform-misc - alfresco-transform-misc/alfresco-transform-misc-boot - alfresco-transform-core-aio/alfresco-transform-core-aio - alfresco-transform-core-aio/alfresco-transform-core-aio-boot - - + + + + full-build + + true + + + alfresco-transformer-base + alfresco-transform-imagemagick/alfresco-transform-imagemagick + alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot + alfresco-transform-libreoffice/alfresco-transform-libreoffice + alfresco-transform-libreoffice/alfresco-transform-libreoffice-boot + alfresco-transform-misc/alfresco-transform-misc + alfresco-transform-misc/alfresco-transform-misc-boot + alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer + alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer-boot + alfresco-transform-tika/alfresco-transform-tika + alfresco-transform-tika/alfresco-transform-tika-boot + alfresco-transform-core-aio/alfresco-transform-core-aio + alfresco-transform-core-aio/alfresco-transform-core-aio-boot + + + + base + + alfresco-transformer-base + + + + imagemagick + + alfresco-transformer-base + alfresco-transform-imagemagick/alfresco-transform-imagemagick + alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot + + + + libreoffice + + alfresco-transformer-base + alfresco-transform-imagemagick/alfresco-transform-imagemagick + alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot + + + + misc + + alfresco-transformer-base + alfresco-transform-misc/alfresco-transform-misc + alfresco-transform-misc/alfresco-transform-misc-boot + + + + pdf-renderer + + alfresco-transformer-base + alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer + alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer-boot + + + + tika + + alfresco-transformer-base + alfresco-transform-tika/alfresco-transform-tika + alfresco-transform-tika/alfresco-transform-tika-boot + + + + + aio-test + + alfresco-transformer-base + alfresco-transform-core-aio/alfresco-transform-core-aio + alfresco-transform-core-aio/alfresco-transform-core-aio-boot + + + scm:git:https://github.com/Alfresco/alfresco-transform-core.git scm:git:https://github.com/Alfresco/alfresco-transform-core.git @@ -204,6 +269,14 @@ + + false + org.apache.maven.plugins + maven-deploy-plugin + + ${parent.core.deploy.skip} + +