Skip to content

Commit

Permalink
Set a different jdk went running forked test (fix scala#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
MasseGuillaume committed Jul 3, 2018
1 parent a4f7b08 commit eb87dbe
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 26 deletions.
54 changes: 30 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ language: scala

scala:
- 2.11.12
- 2.12.6
- 2.13.0-M4
# - 2.12.6
# - 2.13.0-M4
jdk:
- openjdk7
- oraclejdk8
- openjdk6
# - oraclejdk8
env:
global:
# PGP_PASSPHRASE
Expand All @@ -15,39 +15,44 @@ env:
- secure: "oStf8s+LwXcmVENMnWU970OAImwXLV2E6FNXSLE7zdr4YL70cWVsDXDeAs0LSEmiOXTtHulmcIwUt6fCqZ1aiTxUxGX2avy0DSM9nCrQit7IXfwX8V9iK9/3t/SXo1g8yEfxyug+OK6CKOlLeA9HY/TJjO6fkYCsR1NrD8PLpgGtgSwS1GGjifbdahkQyyyivxROJ2UaRysm8PJ1X1966FoQoXKLU4HEztO48y3ZIlItZGwVv/1FJ18AniU2oCnV6XQVM+OB/j+IxNENzLBvd54/YjVtRRa22KTlC8j/NXo8Vq/f0ZhLjNLzYIEB1ER+2T2dthpek+Y8eMR5RdHrFj4Xp2kB04K70ZIL6pw2BDpqeiabjm1E3X6c+flj4pWR5p8uXguV7JmhYgl9d2UEqP7ZTzSbgh2S2WG9EjyK4C2L9jimgBP+Nih2yeW8GuURKgjQ5zrg3+7vxXqBjNN4PmTLpGiQ5shK1kZCpzdgfTl3LfUO4Uitg2Vl8yFC3Z9d3Fo5oV84DhL20pMIx7CtIcMX4b5QHArbUyICYFOvuz+8qP67kTPLVoErNmKWjqpp64VarqfoVbbe4NwRgGuNSMPR1nHb1LjloXv1CiNs9AocvnTknhV1T9I4F4XWi/J6mEwUbVW7GppzqszO6cAgcPLbqp92U8I+rexPjiieCZ0="
# SONA_PASS
- secure: "m0Fw/eH7RXJJoBTfqV6CMd7kaIN2pRPnQPNXJGb546UjqYAlYTkfjvVrWpsgpisRBptI1FEHn24yGbgAHjIes/4un/O62K66I0BffL8PbdeHeNcDjSrTesKEqage2mQfGOiqccVsmkgiKeXNYL8tPZRmPQQ3XZ97mS1SXWlqAJSMW6HfNnvqW14Gdb/snR6I8lQ2o5tRnLerWPnI96pp+xjZca2lD4XDvH2wLJXXLmYY61e23ZYzZMepxBxhGa7js3YTYzCWNrOfBLjFJ5nwRxbjR0WMuz5z5Gdy715WtguKS4Fffd/GJHycLROBU9LCAQDMTxMFvqzFqVFpfq0BuTmmkXFXj+a7dO+ABG0RfoDfoMjn7pHwyHNCZyMMuR1HCjMkbGFwC+Zme2UAYNivtcsuWWeMuypwjyqjfFfNns4FHJ0SXFtC/6+OJkAuUdbEJKReYWKWEsP5SnCH/8PLlc+uUl3tjQkFLc1sOAyx9cTWyBErwuJXhgTrjT9AWvO+fvhcm8z/p5+aaF/U9GIrzPqziX4hGjzc/WC+rsFJSiBDlFQl7br+m8WWs7/wuXqPGXmhf0BNQViDi7fZndDHcY3p3T0An05d/IMKjCUrgLDlJi6VYs9XN7S8ay6MH+XTwIsJGSxtGjfEO4rHGIjtR2GRr8TqdNfnpsI3ucbia1Y="
matrix:
- SCALAJS_VERSION=
- SCALAJS_VERSION=0.6.23
- SCALAJS_VERSION=1.0.0-M3
# matrix:
# - SCALAJS_VERSION=
# - SCALAJS_VERSION=0.6.23
# - SCALAJS_VERSION=1.0.0-M3

matrix:
exclude:
# > 2.12 requires jdk8
- jdk: openjdk7
scala: 2.12.6
# exclude:
# # > 2.12 requires jdk8
# - jdk: openjdk6
# scala: 2.12.6

- jdk: openjdk7
scala: 2.13.0-M4
# - jdk: openjdk6
# scala: 2.13.0-M4

# ?
- jdk: oraclejdk8
scala: 2.11.12
# # ?
# - jdk: oraclejdk8
# scala: 2.11.12

# 2.13.0-M4 is not available in Scala.js 1.0.0-M3
- scala: 2.13.0-M4
env: SCALAJS_VERSION=1.0.0-M3
# # 2.13.0-M4 is not available in Scala.js 1.0.0-M3
# - scala: 2.13.0-M4
# env: SCALAJS_VERSION=1.0.0-M3

# run migration test
include:
- scala: 2.12.6
jdk: oraclejdk8
env: TEST_SCALAFIX=true
- addons:
apt:
packages:
- openjdk-6-jdk
jdk: openjdk6

# | jdk | scala | scala target | scala target version | scalafix test |
# | ----------- | --------- | ------------ | -------------------- |---------------|
# | openjdk7 | 2.11.12 | jvm | | |
# | openjdk7 | 2.11.12 | js | 0.6.23 | |
# | openjdk7 | 2.11.12 | js | 1.0.0-M3 | |
# | openjdk6 | 2.11.12 | jvm | | |
# | openjdk6 | 2.11.12 | js | 0.6.23 | |
# | openjdk6 | 2.11.12 | js | 1.0.0-M3 | |
# | oraclejdk8 | 2.12.6 | jvm | | |
# | oraclejdk8 | 2.12.6 | js | 0.6.23 | |
# | oraclejdk8 | 2.12.6 | js | 1.0.0-M3 | |
Expand All @@ -57,7 +62,8 @@ matrix:

before_script: ./checkCLA.sh
script:
- java -version
- java -version # always oraclejdk8
- echo $JAVA_HOME
- admin/build.sh

cache:
Expand Down
2 changes: 1 addition & 1 deletion admin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then
fi
fi
sbt -Dhttps.protocols=TLSv1.2 -sbt-dir=/home/travis/.sbt ";$crossScalaVersion ;$publishVersion ;$projectPrefix/clean ;$testProjectPrefix/test ;$projectPrefix/publishLocal ;$publishTask"
sbt -Dhttps.protocols=TLSv1.2 ";$crossScalaVersion ;$publishVersion ;$projectPrefix/clean ;$testProjectPrefix/test ;$projectPrefix/publishLocal ;$publishTask"
9 changes: 8 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ lazy val compat = crossProject(JSPlatform, JVMPlatform)
)
.jvmSettings(
OsgiKeys.exportPackage := Seq(s"scala.collection.compat.*;version=${version.value}"),
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test",
javaHome := {
val oldValue = javaHome.value
val isOnCi = sys.env.get("CI").isDefined

if (isOnCi) Some(file(sys.env("JAVA_HOME")))
else oldValue
}
)
.jsSettings(
scalacOptions += {
Expand Down
25 changes: 25 additions & 0 deletions compat/src/test/scala/test/scala/collection/JdkVersionTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package test.scala.collection

import org.junit.Assert._
import org.junit.Test

class JdkVersionTest {

@Test
def testJavaVersion: Unit = {
val isOnCi = sys.env.get("CI").isDefined

if (isOnCi) {
val travisJdkVersion = sys.env("TRAVIS_JDK_VERSION")
val jdkVersion = sys.props("java.specification.version")

if (travisJdkVersion == "openjdk6") {
assertEquals(jdkVersion, "1.6")
} else if (travisJdkVersion == "oraclejdk8") {
assertEquals(jdkVersion, "1.8")
} else {
throw new Exception(s"Unknown CI jdk version: $travisJdkVersion")
}
}
}
}

0 comments on commit eb87dbe

Please sign in to comment.