diff --git a/.travis.yml b/.travis.yml index b318abfa1..138efd029 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,47 +11,54 @@ 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 - - TEST_SUITE=bazel - -# Prerequisites for Bazel -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - curl - - pkg-config - - zip - - g++ - - zlib1g-dev - - unzip - - python - -sudo: $TEST_SUITE = bazel +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 + - name: "Bazel" + sudo: true + script: + # Prerequisites for Bazel + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - curl + - pkg-config + - zip + - g++ + - zlib1g-dev + - unzip + - python # 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 - -script: ./scripts/run-tests.sh +install: +- java -version +- javac -version +- ./mvnw -version -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. @@ -72,7 +79,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 @@ -88,5 +95,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 2c7536b87..94c5ebf82 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