From 6f1e6c36d9ebdd0566a8b039c29424f50c01316e Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Wed, 14 Feb 2018 18:49:11 -0500 Subject: [PATCH] cross JVM testing This continues to use Oracle JDK 8 for building, but adds test jobs using oraclejdk8, oraclejdk9, and oraclejdk10. --- .gitignore | 2 +- .travis.yml | 65 ++++++++++++++++++++++++--------- citest/Hello.scala | 5 +++ citest/install-jdk10.sh | 20 ++++++++++ citest/project/build.properties | 2 +- citest/test.sh | 22 +++++++++++ project/build.properties | 1 - 7 files changed, 97 insertions(+), 20 deletions(-) create mode 100644 citest/Hello.scala create mode 100755 citest/install-jdk10.sh create mode 100755 citest/test.sh diff --git a/.gitignore b/.gitignore index ebfcd37f5..87178428e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ src_managed .lib /template-project/project/boot *~ - +/citest/freshly-baked/ diff --git a/.travis.yml b/.travis.yml index 38409a5e0..186b785db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,53 @@ dist: trusty -addons: - apt: - packages: - - fakeroot + language: scala -script: - - sbt -Dsbt.build.version=1.0.3 ++$TRAVIS_SCALA_VERSION rpm:packageBin debian:packageBin universal:packageBin + +env: + global: + - SBT_VER=1.1.1 + +matrix: + include: + ## build using JDK 8, test using JDK 8 + - script: + - sbt -Dsbt.build.version=$SBT_VER universal:packageBin + - cd citest && ./test.sh + + ## build using JDK 8, test using JDK 9 + - script: + - sbt -Dsbt.build.version=$SBT_VER universal:packageBin + - jdk_switcher use oraclejdk9 + - cd citest && ./test.sh + + ## build using JDK 8, test using JDK 10 + - script: + - sbt -Dsbt.build.version=$SBT_VER universal:packageBin + - citest/install-jdk10.sh + - cd citest && ./test.sh + + - script: + - sbt -Dsbt.build.version=$SBT_VER rpm:packageBin debian:packageBin + addons: + apt: + packages: + - fakeroot + - rpm + scala: - - 2.10.3 + - 2.10.7 + jdk: - oraclejdk8 -notifications: - email: - - sbt-dev-bot@googlegroups.com -before_install: - - cat /etc/hosts # optionally check the content *before* - - sudo hostname "$(hostname | cut -c1-63)" - - sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts - - cat /etc/hosts # optionally check the content *after* - - sudo apt-get update -qq - - sudo apt-get install -qq rpm + +# Undo _JAVA_OPTIONS environment variable +before_script: + - _JAVA_OPTIONS= + +cache: + directories: + - $HOME/.ivy2/cache + - $HOME/.sbt/boot + +before_cache: + - find $HOME/.ivy2 -name "ivydata-*.properties" -delete + - find $HOME/.sbt -name "*.lock" -delete diff --git a/citest/Hello.scala b/citest/Hello.scala new file mode 100644 index 000000000..b6b4d95ba --- /dev/null +++ b/citest/Hello.scala @@ -0,0 +1,5 @@ +package foo + +object Hello extends App { + println("hello") +} diff --git a/citest/install-jdk10.sh b/citest/install-jdk10.sh new file mode 100755 index 000000000..0693a6890 --- /dev/null +++ b/citest/install-jdk10.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# copied from https://github.com/junit-team/junit5/blob/master/src/install/install-jdk-10.sh + +set -e + +JDK_FEATURE=10 +TMP=$(curl -L jdk.java.net/${JDK_FEATURE}) # extract most recent "JDK_BUILD" number from web page source... +TMP="${TMP#*Most recent build: jdk-${JDK_FEATURE}+}" # remove everything before the number +TMP="${TMP%%<*}" # remove everything after the number +JDK_BUILD="$(echo -e "${TMP}" | tr -d '[:space:]')" # remove all whitespace +JDK_ARCHIVE=jdk-${JDK_FEATURE}+${JDK_BUILD}_linux-x64_bin.tar.gz + +cd ~ +wget http://download.java.net/java/jdk${JDK_FEATURE}/archive/${JDK_BUILD}/BCL/${JDK_ARCHIVE} +tar -xzf ${JDK_ARCHIVE} +export JAVA_HOME=~/jdk-${JDK_FEATURE} +export PATH=${JAVA_HOME}/bin:$PATH +cd - +java --version diff --git a/citest/project/build.properties b/citest/project/build.properties index 394cb75cf..31334bbd3 100644 --- a/citest/project/build.properties +++ b/citest/project/build.properties @@ -1 +1 @@ -sbt.version=1.0.4 +sbt.version=1.1.1 diff --git a/citest/test.sh b/citest/test.sh new file mode 100755 index 000000000..64d40c80a --- /dev/null +++ b/citest/test.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +## https://github.com/travis-ci/travis-ci/issues/8408 +export _JAVA_OPTIONS= + +## begin Java switching +## swtich to JDK 10 if we've downloaded it +if [ -d ~/jdk-10 ] +then + JAVA_HOME=~/jdk-10 +fi +## include JAVA_HOME into path +PATH=${JAVA_HOME}/bin:$PATH +java -version +## end of Java switching + +mkdir freshly-baked +unzip -qo ../target/universal/sbt.zip -d ./freshly-baked + +SBT_OPTS=-Dfile.encoding=UTF-8 + +./freshly-baked/sbt/bin/sbt about run diff --git a/project/build.properties b/project/build.properties index 3689a86a2..c091b86ca 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1 @@ sbt.version=0.13.16 -