File tree Expand file tree Collapse file tree 5 files changed +65
-4
lines changed
Expand file tree Collapse file tree 5 files changed +65
-4
lines changed Original file line number Diff line number Diff line change 2525 strategy :
2626 fail-fast : false
2727 matrix :
28- java : [8, 11, 17]
28+ java : [11, 17]
2929 steps :
3030 - uses : actions/checkout@v3
3131 - uses : actions/setup-java@v3
@@ -36,14 +36,42 @@ jobs:
3636 - run : .kokoro/build.sh
3737 env :
3838 JOB_TYPE : test
39+ units-java8 :
40+ name : " units (8)"
41+ runs-on : ubuntu-latest
42+ steps :
43+ - uses : actions/checkout@v3
44+ - uses : actions/setup-java@v3
45+ with :
46+ java-version : 8
47+ distribution : zulu
48+ - run : echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
49+ shell : bash
50+ - uses : actions/setup-java@v3
51+ with :
52+ java-version : 11
53+ distribution : zulu
54+ - run : echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
55+ shell : bash
56+ - run : .kokoro/build.sh
57+ env :
58+ JOB_TYPE : test
3959 windows :
4060 runs-on : windows-latest
4161 steps :
4262 - uses : actions/checkout@v3
4363 - uses : actions/setup-java@v3
4464 with :
45- distribution : zulu
4665 java-version : 8
66+ distribution : zulu
67+ - run : echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
68+ shell : bash
69+ - uses : actions/setup-java@v3
70+ with :
71+ java-version : 11
72+ distribution : zulu
73+ - run : echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
74+ shell : bash
4775 - run : java -version
4876 - run : .kokoro/build.bat
4977 env :
Original file line number Diff line number Diff line change @@ -23,6 +23,17 @@ cd ${scriptDir}/..
2323# include common functions
2424source ${scriptDir} /common.sh
2525
26+ function setJava() {
27+ export JAVA_HOME=$1
28+ export PATH=${JAVA_HOME} /bin:$PATH
29+ }
30+
31+ # units-java8 uses both JDK 11 and JDK 8. GraalVM dependencies require JDK 11 to
32+ # compile the classes touching GraalVM classes.
33+ if [ ! -z " ${JAVA11_HOME} " ]; then
34+ setJava " ${JAVA11_HOME} "
35+ fi
36+
2637# Print out Maven & Java version
2738mvn -version
2839echo ${JOB_TYPE}
@@ -42,12 +53,19 @@ if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTI
4253 export GOOGLE_APPLICATION_CREDENTIALS=$( realpath ${KOKORO_GFILE_DIR} /${GOOGLE_APPLICATION_CREDENTIALS} )
4354fi
4455
56+ # units-java8 uses both JDK 11 and JDK 8. We ensure the generated class files
57+ # are compatible with Java 8 when running tests.
58+ if [ ! -z " ${JAVA8_HOME} " ]; then
59+ setJava " ${JAVA8_HOME} "
60+ mvn -version
61+ fi
62+
4563RETURN_CODE=0
4664set +e
4765
4866case ${JOB_TYPE} in
4967test)
50- mvn test -B \
68+ mvn test -B -V \
5169 -Dclirr.skip=true \
5270 -Denforcer.skip=true \
5371 -Djava.net.preferIPv4Stack=true
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ build_file: "java-spanner/.kokoro/trampoline.sh"
99# Configure the docker image for kokoro-trampoline.
1010env_vars: {
1111 key: " TRAMPOLINE_IMAGE"
12- value: " gcr.io/cloud-devrel-kokoro-resources/java8 "
12+ value: " gcr.io/cloud-devrel-kokoro-resources/java11 "
1313}
1414
1515before_action {
Original file line number Diff line number Diff line change 3232 ".kokoro/presubmit/java8-samples.cfg" ,
3333 ".kokoro/presubmit/java11-samples.cfg" ,
3434 ".kokoro/presubmit/samples.cfg" ,
35+ ".kokoro/release/common.cfg" ,
3536 "samples/install-without-bom/pom.xml" ,
3637 "samples/snapshot/pom.xml" ,
3738 "samples/snippets/pom.xml" ,
4041 ".github/release-please.yml" ,
4142 ".github/blunderbuss.yml" ,
4243 ".github/workflows/samples.yaml" ,
44+ ".github/workflows/ci.yaml" ,
4345 ".kokoro/build.sh" ,
4446 ]
4547)
Original file line number Diff line number Diff line change 224224 </plugins >
225225 </reporting >
226226
227+ <profiles >
228+ <profile >
229+ <!-- JDK 9+ has the "release" option to ensure the generated bytecode is
230+ compatible with Java 8. -->
231+ <id >compiler-release-8</id >
232+ <activation >
233+ <jdk >[9,]</jdk >
234+ </activation >
235+ <properties >
236+ <maven .compiler.release>8</maven .compiler.release>
237+ </properties >
238+ </profile >
239+ </profiles >
227240</project >
You can’t perform that action at this time.
0 commit comments