Skip to content

Commit

Permalink
Merge branch 'master' into travis-bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
regisd committed Sep 30, 2018
2 parents 1f46100 + 94c296a commit 1353a06
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 40 deletions.
73 changes: 40 additions & 33 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -88,5 +95,5 @@ deploy:
- travis
condition:
- $TEST_SUITE = unit
- $TRAVIS_JDK_VERSION = oraclejdk8
- $TRAVIS_JDK_VERSION = openjdk9
script: ./scripts/deploy-source-code.sh
18 changes: 18 additions & 0 deletions scripts/run-ant.sh
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 5 additions & 7 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1353a06

Please sign in to comment.