mirror of
https://github.com/apache/nifi.git
synced 2025-02-08 19:14:57 +00:00
f671a37aed
Introduced stages to cache dependencies before build and test Added --fail-never to dependency cache stage to allow dependency:go-offline to finish and update the cache with any dependencies that were able to be downloaded Added download of AdoptOpenJDK 11.0.4 for the Java 11 build Removed setting environment variables to enable easier sharing of cache between build, region/language settings are passed in via the command line when invoking maven Formatted scripts to allow multiline commands for more readability Replaced "exit ${PIPESTATUS[0]}" with "test ${PIPESTATUS[0]} -eq 0" to avoid using "exit" in script, which prevents Travis from completing the cache upload after the build completes Install Maven 3.6.1 for the -ntp (no-transfer-progress) feature Updated all build stages to exclude non-api nar and assembly modules to decrease build time Dependency cache stages check if the cached maven repository doesn't exist or is empty before attempting to download dependencies Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes #3644.
127 lines
6.2 KiB
YAML
127 lines
6.2 KiB
YAML
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
# this work for additional information regarding copyright ownership.
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
# (the "License"); you may not use this file except in compliance with
|
|
# the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
language: java
|
|
|
|
matrix:
|
|
include:
|
|
- stage: "Cache"
|
|
name: "Cache Dependencies - no explicit jdk specified"
|
|
script: >-
|
|
if [ ! -d "$HOME"/.m2/repository ] || [ ! "$(ls -A "$HOME"/.m2/repository)" ] ; then
|
|
echo "Cached Maven repository does not exist, downloading dependencies..."
|
|
mvn -V -T 1C dependency:go-offline -Dsilent -ntp --fail-never \
|
|
| grep -v -F -f .travis-output-filters -e "Failed to execute goal on project"
|
|
else
|
|
echo "Cached Maven repository exists, skipping dependency cache"
|
|
fi
|
|
- stage: "Cache"
|
|
name: "Cache Dependencies - openjdk8"
|
|
jdk: openjdk8
|
|
script: >-
|
|
if [ ! -d "$HOME"/.m2/repository ] || [ ! "$(ls -A "$HOME"/.m2/repository)" ] ; then
|
|
echo "Cached Maven repository does not exist, downloading dependencies..."
|
|
mvn -V -T 1C dependency:go-offline -Dsilent -ntp --fail-never \
|
|
| grep -v -F -f .travis-output-filters -e "Failed to execute goal on project"
|
|
else
|
|
echo "Cached Maven repository exists, skipping dependency cache"
|
|
fi
|
|
# For the build stages, use -pl to exclude the following from the build to reduce build time:
|
|
# non-api nar modules
|
|
# assembly modules
|
|
# nifi-maven-archetype directories that have "__" in the name
|
|
- stage: "Build"
|
|
name: "Build Java 8 EN"
|
|
jdk: openjdk8
|
|
script: >-
|
|
mvn clean install -V -T 1C
|
|
-pl `find . -type d \( -name "*-nar" -or -name "*-assembly" \) -and -not -name "*api-nar" -and -not -path "*/target/*" -and -not -name "*__*" -printf "!./%P,"`
|
|
-Pcontrib-check,include-grpc -Ddir-only
|
|
-Dmaven.surefire.arguments="-Duser.language=en -Duser.region=US"
|
|
| grep -v -F -f .travis-output-filters
|
|
&& test ${PIPESTATUS[0]} -eq 0
|
|
- stage: "Build"
|
|
name: "Build Java 8 FR"
|
|
jdk: openjdk8
|
|
script: >-
|
|
mvn clean install -V -T 1C
|
|
-pl `find . -type d \( -name "*-nar" -or -name "*-assembly" \) -and -not -name "*api-nar" -and -not -path "*/target/*" -and -not -name "*__*" -printf "!./%P,"`
|
|
-Pcontrib-check,include-grpc -Ddir-only
|
|
-Dmaven.surefire.arguments="-Duser.language=fr -Duser.region=FR"
|
|
| grep -v -F -f .travis-output-filters
|
|
&& test ${PIPESTATUS[0]} -eq 0
|
|
- stage: "Build"
|
|
name: "Build Java 8 JA"
|
|
jdk: openjdk8
|
|
script: >-
|
|
mvn clean install -V -T 1C
|
|
-pl `find . -type d \( -name "*-nar" -or -name "*-assembly" \) -and -not -name "*api-nar" -and -not -path "*/target/*" -and -not -name "*__*" -printf "!./%P,"`
|
|
-Pcontrib-check,include-grpc -Ddir-only
|
|
-Dmaven.surefire.arguments="-Duser.language=ja -Duser.region=JP"
|
|
| grep -v -F -f .travis-output-filters
|
|
&& test ${PIPESTATUS[0]} -eq 0
|
|
- stage: "Build"
|
|
name: "Build Java 11 EN"
|
|
# Do not specify "jdk:" here, install-jdk.sh will download the JDK set JAVA_HOME appropriately
|
|
before_script:
|
|
# Download the newest version of sormuras' install-jdk.sh to /tmp
|
|
# install-jdk.sh is used by Travis internally, sormoras is the maintainer of that script
|
|
- wget -O /tmp/install-jdk.sh https://github.com/sormuras/bach/raw/master/install-jdk.sh
|
|
# Need to specifically install AdoptOpenJDK 11.0.4 (Linux, HotSpot) since Travis does not offer it by default
|
|
# The link to the AdoptOpenJDK 11.0.4 .tar.gz is taken directly from AdoptOpenJDK's website
|
|
- >-
|
|
source /tmp/install-jdk.sh
|
|
--url 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_x64_linux_hotspot_11.0.4_11.tar.gz'
|
|
script:
|
|
- >-
|
|
mvn clean install -V -T 1C
|
|
-pl `find . -type d \( -name "*-nar" -or -name "*-assembly" \) -and -not -name "*api-nar" -and -not -path "*/target/*" -and -not -name "*__*" -printf "!./%P,"`
|
|
-Pcontrib-check,include-grpc -Ddir-only
|
|
-Dmaven.surefire.arguments="-Duser.language=en -Duser.region=US"
|
|
| grep -v -F -f .travis-output-filters
|
|
&& test ${PIPESTATUS[0]} -eq 0
|
|
|
|
os:
|
|
- linux
|
|
|
|
# Caches mvn repository in order to speed up builds
|
|
cache:
|
|
directories:
|
|
- $HOME/.m2
|
|
- $HOME/.npm
|
|
|
|
before_cache:
|
|
# Remove nifi repo again to save travis from caching it
|
|
- rm -rf $HOME/.m2/repository/org/apache/nifi/
|
|
|
|
# before_install aids in a couple workarounds for issues within the Travis-CI environment
|
|
# 1. Workaround for buffer overflow issues with OpenJDK versions of java as per https://github.com/travis-ci/travis-ci/issues/5227#issuecomment-165135711
|
|
# 2. Workaround for non-existent Maven repository as per: https://github.com/travis-ci/travis-ci/issues/4629#issuecomment-131214465
|
|
before_install:
|
|
- sudo hostname "$(hostname | cut -c1-63)"
|
|
- sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
|
|
- sed -i.bak -e 's|https://nexus.codehaus.org/snapshots/|https://oss.sonatype.org/content/repositories/codehaus-snapshots/|g' ~/.m2/settings.xml
|
|
- echo "MAVEN_OPTS='-Xmx2g -XX:+UseG1GC'" > ~/.mavenrc
|
|
- cat ~/.mavenrc
|
|
# Remove nifi repo again to save travis from caching it
|
|
- rm -rf $HOME/.m2/repository/org/apache/nifi/
|
|
# Install Maven 3.6.1
|
|
- wget -O /tmp/apache-maven-3.6.1-bin.tar.gz https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
|
|
- tar xzf /tmp/apache-maven-3.6.1-bin.tar.gz -C /tmp
|
|
- export M2_HOME=/tmp/apache-maven-3.6.1
|
|
- export PATH=$M2_HOME/bin:$PATH
|
|
|
|
install: true
|