From ba89167c47d7ced504fe5eccaeb87498fb99247d Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Wed, 4 May 2022 22:21:44 -0400 Subject: [PATCH 1/7] ci: using JDK 11 to compile and JDK 8 to run junit (8) --- .github/workflows/ci.yaml | 20 +++++++++++++++++++- .kokoro/build.sh | 18 ++++++++++++++++++ pom.xml | 13 +++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 83ef7f9c2cf..6529efcd965 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - java: [8, 11, 17] + java: [11, 17] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 @@ -36,6 +36,24 @@ jobs: - run: .kokoro/build.sh env: JOB_TYPE: test + units-java8: + name: "units (8)" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: zulu + - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV + - uses: actions/setup-java@v3 + with: + java-version: 11 + distribution: zulu + - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV + - run: .kokoro/build.sh + env: + JOB_TYPE: test windows: runs-on: windows-latest steps: diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 56aa8c8f5c2..7674e8ec989 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -23,6 +23,17 @@ cd ${scriptDir}/.. # include common functions source ${scriptDir}/common.sh +function setJava() { + export JAVA_HOME=$1 + export PATH=${JAVA_HOME}/bin:$PATH +} + +# units-java8 uses both JDK 11 and JDK 8. GraalVM dependencies require JDK 11 to +# compile the classes touching GraalVM classes. +if [ ! -z "${JAVA11_HOME}" ]; then + setJava "${JAVA11_HOME}" +fi + # Print out Maven & Java version mvn -version echo ${JOB_TYPE} @@ -42,6 +53,13 @@ if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTI export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) fi +# units-java8 uses both JDK 11 and JDK 8. We ensure the generated class files +# are compatible with Java 8 when running tests. +if [ ! -z "${JAVA8_HOME}" ]; then + setJava "${JAVA8_HOME}" + mvn -version +fi + RETURN_CODE=0 set +e diff --git a/pom.xml b/pom.xml index 6f81a5acc31..a39c58de864 100644 --- a/pom.xml +++ b/pom.xml @@ -224,4 +224,17 @@ + + + + compiler-release-8 + + [9,] + + + 8 + + + From a18055cea380250a3027b09136288d9383d82cf7 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Thu, 5 May 2022 09:36:21 -0400 Subject: [PATCH 2/7] ci: release build to use JDK 11 --- .kokoro/release/common.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index adffcbe4873..7872aea54d8 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -9,7 +9,7 @@ build_file: "java-spanner/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" } before_action { From 100f41ee25fc7b5029de11cd58d6482b9154e5f1 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 20 May 2022 10:50:55 -0400 Subject: [PATCH 3/7] build: configuring owlbot.py to exclusion --- owlbot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/owlbot.py b/owlbot.py index c8e92761fcc..cb907a9878c 100644 --- a/owlbot.py +++ b/owlbot.py @@ -32,6 +32,7 @@ ".kokoro/presubmit/java8-samples.cfg", ".kokoro/presubmit/java11-samples.cfg", ".kokoro/presubmit/samples.cfg", + ".kokoro/release/common.cfg", "samples/install-without-bom/pom.xml", "samples/snapshot/pom.xml", "samples/snippets/pom.xml", @@ -40,6 +41,7 @@ ".github/release-please.yml", ".github/blunderbuss.yml", ".github/workflows/samples.yaml", + ".github/workflows/ci.yaml", ".kokoro/build.sh", ] ) From e42a5724e926b30fa47e5ca551e162dbe759e3bc Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 20 May 2022 10:53:26 -0400 Subject: [PATCH 4/7] ci: windows build for JDK 11 and 8 --- .github/workflows/ci.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6529efcd965..7b39cb7fa8a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -60,8 +60,14 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - distribution: zulu java-version: 8 + distribution: zulu + - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV + - uses: actions/setup-java@v3 + with: + java-version: 11 + distribution: zulu + - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV - run: java -version - run: .kokoro/build.bat env: From ac77054e83625329f1effe3d90ae76661483174e Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 20 May 2022 11:10:16 -0400 Subject: [PATCH 5/7] investigating windows environment variables --- .kokoro/build.bat | 2 ++ .kokoro/build.sh | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.kokoro/build.bat b/.kokoro/build.bat index 067cf4a4c48..98b0ecc17c9 100644 --- a/.kokoro/build.bat +++ b/.kokoro/build.bat @@ -15,4 +15,6 @@ :: downstream client libraries before they are released. :: See documentation in type-shell-output.bat +SET + "C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 7674e8ec989..4d03e6063c2 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -15,6 +15,9 @@ set -eo pipefail +echo "Environment variables:" +printenv + ## Get the directory of the build script scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) ## cd to the parent directory, i.e. the root of the git repo @@ -65,7 +68,7 @@ set +e case ${JOB_TYPE} in test) - mvn test -B \ + mvn test -B -V \ -Dclirr.skip=true \ -Denforcer.skip=true \ -Djava.net.preferIPv4Stack=true From 52a12143e1af93eee257107b3dea52c54a524d72 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 20 May 2022 11:15:36 -0400 Subject: [PATCH 6/7] shell: bash for windows --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7b39cb7fa8a..0ef324c71e3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,11 +46,13 @@ jobs: java-version: 8 distribution: zulu - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV + shell: bash - uses: actions/setup-java@v3 with: java-version: 11 distribution: zulu - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV + shell: bash - run: .kokoro/build.sh env: JOB_TYPE: test @@ -63,11 +65,13 @@ jobs: java-version: 8 distribution: zulu - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV + shell: bash - uses: actions/setup-java@v3 with: java-version: 11 distribution: zulu - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV + shell: bash - run: java -version - run: .kokoro/build.bat env: From ec67faf39bf657d95c40e4bc2f9d5e62f13204a3 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 20 May 2022 11:20:33 -0400 Subject: [PATCH 7/7] removed debug output --- .kokoro/build.bat | 2 -- .kokoro/build.sh | 3 --- 2 files changed, 5 deletions(-) diff --git a/.kokoro/build.bat b/.kokoro/build.bat index 98b0ecc17c9..067cf4a4c48 100644 --- a/.kokoro/build.bat +++ b/.kokoro/build.bat @@ -15,6 +15,4 @@ :: downstream client libraries before they are released. :: See documentation in type-shell-output.bat -SET - "C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 4d03e6063c2..1b8cfc5620f 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -15,9 +15,6 @@ set -eo pipefail -echo "Environment variables:" -printenv - ## Get the directory of the build script scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) ## cd to the parent directory, i.e. the root of the git repo