diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b91fa381f..8aa5b7b9e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -67,7 +67,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: temurin - java-version: 8 + java-version: 17 - run: java -version - run: .kokoro/build.bat env: @@ -116,7 +116,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: temurin - java-version: 8 + java-version: 17 - run: java -version - run: .kokoro/build.sh env: diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 64165868a..dda0da46d 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -30,13 +30,6 @@ echo ${JOB_TYPE} # Store the current Java version since the version may change when installing sdk-platform-java current_java_home=$JAVA_HOME -# testing-infra-docker has Java 11 installed in java8 docker container. Use this as sdk-platform-java -# needs Java 11+ to run with GraalVM. For GH actions, JAVA11_HOME does not exist and would skip this. -if [ ! -z "${JAVA11_HOME}" ]; then - export JAVA_HOME="${JAVA11_HOME}" - export PATH=${JAVA_HOME}/bin:$PATH -fi - # Get the current proto runtime version used in this repo CURRENT_PROTO_VERSION=$(mvn -ntp help:effective-pom | sed -n "/protobuf-java<\/artifactId>/,/<\/dependency>/ { @@ -53,6 +46,13 @@ echo "The latest proto version is: ${LATEST_PROTO_VERSION}" # Only reinstall shared-deps again to test for a newer proto version if [[ "${CURRENT_PROTO_VERSION}" != "${LATEST_PROTO_VERSION}" ]]; then + # testing-infra-docker has Java 11 installed in java8 docker container. Use this as sdk-platform-java + # needs Java 11+ to run with GraalVM. For GH actions, JAVA11_HOME does not exist and would skip this. + if [ ! -z "${JAVA11_HOME}" ]; then + export JAVA_HOME="${JAVA11_HOME}" + export PATH=${JAVA_HOME}/bin:$PATH + fi + pushd /tmp git clone https://github.com/googleapis/sdk-platform-java.git pushd sdk-platform-java @@ -96,11 +96,11 @@ if [[ "${CURRENT_PROTO_VERSION}" != "${LATEST_PROTO_VERSION}" ]]; then # "${pom}" fi done -fi -# Reset back to the original Java version if changed -export JAVA_HOME="${current_java_home}" -export PATH=${JAVA_HOME}/bin:$PATH + # Reset back to the original Java version if changed + export JAVA_HOME="${current_java_home}" + export PATH=${JAVA_HOME}/bin:$PATH +fi # attempt to install 3 times with exponential backoff (starting with 10 seconds) retry_with_backoff 3 10 \