ATS-724 Parallel Travis builds (#223)

* Split Build and test into separate jobs.
This commit is contained in:
David Edwards 2020-04-20 16:10:32 +01:00 committed by GitHub
parent a233a47a87
commit 352388832d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 171 additions and 45 deletions

View File

@ -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

17
_ci/build.sh Normal file → Executable file
View File

@ -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 =========================="

26
_ci/test.sh Executable file
View File

@ -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 =========================="

View File

@ -11,6 +11,10 @@
<artifactId>alfresco-transformer-base</artifactId>
<version>2.2.0-A5-SNAPSHOT</version>
<properties>
<transformer.base.deploy.skip>false</transformer.base.deploy.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -81,6 +85,13 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>${transformer.base.deploy.skip}</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

105
pom.xml
View File

@ -28,24 +28,89 @@
<dependency.jackson.version>2.10.3</dependency.jackson.version>
<dependency.cxf.version>3.3.5</dependency.cxf.version>
<dependency.poi.version>4.1.1</dependency.poi.version>
<parent.core.deploy.skip>false</parent.core.deploy.skip>
</properties>
<modules>
<module>alfresco-transformer-base</module>
<module>alfresco-transform-tika/alfresco-transform-tika</module>
<module>alfresco-transform-tika/alfresco-transform-tika-boot</module>
<module>alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer</module>
<module>alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer-boot</module>
<module>alfresco-transform-libreoffice/alfresco-transform-libreoffice</module>
<module>alfresco-transform-libreoffice/alfresco-transform-libreoffice-boot</module>
<module>alfresco-transform-imagemagick/alfresco-transform-imagemagick</module>
<module>alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot</module>
<module>alfresco-transform-misc/alfresco-transform-misc</module>
<module>alfresco-transform-misc/alfresco-transform-misc-boot</module>
<module>alfresco-transform-core-aio/alfresco-transform-core-aio</module>
<module>alfresco-transform-core-aio/alfresco-transform-core-aio-boot</module>
</modules>
<profiles>
<profile>
<id>full-build</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>alfresco-transformer-base</module>
<module>alfresco-transform-imagemagick/alfresco-transform-imagemagick</module>
<module>alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot</module>
<module>alfresco-transform-libreoffice/alfresco-transform-libreoffice</module>
<module>alfresco-transform-libreoffice/alfresco-transform-libreoffice-boot</module>
<module>alfresco-transform-misc/alfresco-transform-misc</module>
<module>alfresco-transform-misc/alfresco-transform-misc-boot</module>
<module>alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer</module>
<module>alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer-boot</module>
<module>alfresco-transform-tika/alfresco-transform-tika</module>
<module>alfresco-transform-tika/alfresco-transform-tika-boot</module>
<module>alfresco-transform-core-aio/alfresco-transform-core-aio</module>
<module>alfresco-transform-core-aio/alfresco-transform-core-aio-boot</module>
</modules>
</profile>
<profile>
<id>base</id>
<modules>
<module>alfresco-transformer-base</module>
</modules>
</profile>
<profile>
<id>imagemagick</id>
<modules>
<module>alfresco-transformer-base</module>
<module>alfresco-transform-imagemagick/alfresco-transform-imagemagick</module>
<module>alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot</module>
</modules>
</profile>
<profile>
<id>libreoffice</id>
<modules>
<module>alfresco-transformer-base</module>
<module>alfresco-transform-imagemagick/alfresco-transform-imagemagick</module>
<module>alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot</module>
</modules>
</profile>
<profile>
<id>misc</id>
<modules>
<module>alfresco-transformer-base</module>
<module>alfresco-transform-misc/alfresco-transform-misc</module>
<module>alfresco-transform-misc/alfresco-transform-misc-boot</module>
</modules>
</profile>
<profile>
<id>pdf-renderer</id>
<modules>
<module>alfresco-transformer-base</module>
<module>alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer</module>
<module>alfresco-transform-pdf-renderer/alfresco-transform-pdf-renderer-boot</module>
</modules>
</profile>
<profile>
<id>tika</id>
<modules>
<module>alfresco-transformer-base</module>
<module>alfresco-transform-tika/alfresco-transform-tika</module>
<module>alfresco-transform-tika/alfresco-transform-tika-boot</module>
</modules>
</profile>
<profile>
<!-- Should only be run after all other snapshot images have been build -->
<id>aio-test</id>
<modules>
<module>alfresco-transformer-base</module>
<module>alfresco-transform-core-aio/alfresco-transform-core-aio</module>
<module>alfresco-transform-core-aio/alfresco-transform-core-aio-boot</module>
</modules>
</profile>
</profiles>
<scm>
<connection>scm:git:https://github.com/Alfresco/alfresco-transform-core.git</connection>
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-transform-core.git</developerConnection>
@ -204,6 +269,14 @@
</execution>
</executions>
</plugin>
<plugin>
<inherited>false</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>${parent.core.deploy.skip}</skip>
</configuration>
</plugin>
</plugins>
<pluginManagement>