From 94c296a456f67a953de7747fffe4dce63fef9dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Sun, 30 Sep 2018 17:45:07 +0200 Subject: [PATCH] Travis: drastically reduce the build matrix. (#396) * drastically reduce the build matrix. We have useless matrix expansion (e.g. java-format un JDK8 and java-format in JDK9). Instead of expanding all possible values, explicitely define the inclusion we want. * Invoke scripts directly, rather than wrapping all in run-tests.sh with TEST_SUITE The only one is `TEST_SUITE=unit` which conditionally deploys * Add `mvn site` site in the script phase * Move the ant build after the regression tests because they don't take long. --- .travis.yml | 40 ++++++++++++++++++++++++---------------- scripts/run-ant.sh | 18 ++++++++++++++++++ scripts/run-tests.sh | 12 +++++------- 3 files changed, 47 insertions(+), 23 deletions(-) create mode 100755 scripts/run-ant.sh diff --git a/.travis.yml b/.travis.yml index f28c1d1c5..e0516ab51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,30 +11,38 @@ git: language: java -# TODO(regisd) Remove the build matrix ; it really makes the deploy phase more complex jdk: -- oraclejdk8 - openjdk9 -env: - matrix: - - TEST_SUITE=java-format - - TEST_SUITE=ant - - TEST_SUITE=unit - - TEST_SUITE=regression +matrix: + include: + - name: "Check Java format" + script: scripts/test-java-format.sh + - name: "Maven everything" + script: + - scripts/test-unit.sh + - scripts/mvn-site.sh + - scripts/mvn-aggregate-srcs.sh + env: TEST_SUITE=unit + - name: "Regression tests" + script: scripts/test-regression.sh + - name: "Ant JDK8" + script: scripts/run-ant.sh + sdk: oraclejdk8 + - name: "Ant JDK9" + script: scripts/run-ant.sh # Empty the previously built artifacts # They cannot be deleted in the before_cache phase, # otherwise `mvn site` fails in the before_deploy phase. before_install: ./scripts/clean.sh -install: ./mvnw -version +install: +- java -version +- javac -version +- ./mvnw -version -script: ./scripts/run-tests.sh - -after_success: -- test $TEST_SUITE = "unit" && ./scripts/mvn-site.sh -- test $TEST_SUITE = "unit" && ./scripts/mvn-aggregate-srcs.sh +script: scripts/run-tests.sh # Travis sometimes fails to download deps from repo1.maven.org # A cache avoids downloading too much, and will also speed up the build. @@ -55,7 +63,7 @@ deploy: branch: release condition: - $TEST_SUITE = unit - - $TRAVIS_JDK_VERSION = oraclejdk8 + - $TRAVIS_JDK_VERSION = openjdk9 local_dir: target/maven-staging-site/maven-site # GITHUB_TOKEN set in travis-ci.org dashboard github_token: $GITHUB_TOKEN @@ -71,5 +79,5 @@ deploy: - travis condition: - $TEST_SUITE = unit - - $TRAVIS_JDK_VERSION = oraclejdk8 + - $TRAVIS_JDK_VERSION = openjdk9 script: ./scripts/deploy-source-code.sh diff --git a/scripts/run-ant.sh b/scripts/run-ant.sh new file mode 100755 index 000000000..334bb682e --- /dev/null +++ b/scripts/run-ant.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +CWD="$PWD" +BASEDIR="$(cd "$(dirname "$0")" && pwd -P)"/.. +# Provides the logi function +source "$BASEDIR"/scripts/logger.sh +# Maven executable +MVN="$BASEDIR"/mvnw +# fail on error +set -e + +if [[ -z "$TEST_SUITE" || "$TEST_SUITE" == "ant" ]]; then + "$BASEDIR"/scripts/ant-build.sh + "$BASEDIR"/scripts/test-examples.sh +fi + +logi "Success" +cd "$CWD" diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 8f012ac51..b19a56872 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -9,15 +9,13 @@ MVN="$BASEDIR"/mvnw # fail on error set -e -echo '============================== JAVA VERSION ==============================' -java -version -javac -version -echo '============================================================================' +if [[ $TRAVIS ]]; then + loge "This script is only for manual invocation" + exit 1 +fi # Clean environment -if [[ ! $TRAVIS ]]; then - "$BASEDIR"/scripts/clean.sh -fi +"$BASEDIR"/scripts/clean.sh # Travis then runs _in parallel_ (but we do it in sequence) if [[ -z "$TEST_SUITE" || "$TEST_SUITE" == "java-format" ]]; then