From 5903ad35e1f84320dc46dda567f810a91a288c67 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Fri, 26 Jul 2024 18:24:22 -0400 Subject: [PATCH] chore: Testing --- .kokoro/build.sh | 110 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 102 insertions(+), 8 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 605555ecae..16a0d02fe0 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -27,6 +27,84 @@ source ${scriptDir}/common.sh mvn -version 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>/ { +# //{ +# s/\(.*\)<\/version>/\1/p +# q +# } +#}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') +#echo "The current proto version is: ${CURRENT_PROTO_VERSION}" +# +## Find the latest proto runtime version available +#LATEST_PROTO_VERSION=$(curl -s https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/maven-metadata.xml | sed -n '//s/.*\(.*\)<\/release>.*/\1/p') +#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 +# pushd /tmp +# git clone https://github.com/googleapis/sdk-platform-java.git +# pushd sdk-platform-java +# pushd gapic-generator-java-pom-parent +# sed -i "/.*<\/protobuf.version>/s/\(.*\).*\(<\/protobuf.version>\)/\1${LATEST_PROTO_VERSION}\2/" pom.xml +# # sdk-platform-java +# popd +# +# pushd sdk-platform-java-config +# # Get current Shared-Deps version in sdk-platform-java +# SHARED_DEPS_VERSION=$(mvn -ntp help:effective-pom | +# sed -n "/sdk-platform-java-config<\/artifactId>/,/<\/dependency>/ { +# //{ +# s/\(.*\)<\/version>/\1/p +# q +# } +# }" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') +# echo "Shared-Deps Version: ${SHARED_DEPS_VERSION}" +# # sdk-platform-java +# popd +# mvn clean install -q -ntp \ +# -DskipTests=true \ +# -Dclirr.skip=true \ +# -Denforcer.skip=true \ +# -T 1C +# # /tmp +# popd +# +# # Back to the original directory of the repo +# popd +# # Find all the poms with a reference to shared-deps and update to the new local version +# poms=($(find . -name pom.xml)) +# for pom in "${poms[@]}"; do +# if grep -q "sdk-platform-java-config" "${pom}"; then +# echo "Updating the pom: ${pom} to use shared-deps version: ${SHARED_DEPS_VERSION}" +# sed -i "/sdk-platform-java-config<\/artifactId>/,/<\/parent>/ s/.*<\/version>/$SHARED_DEPS_VERSION<\/version>/" "${pom}" +# cat "${pom}" +## xmlstarlet ed --inplace -N x="http://maven.apache.org/POM/4.0.0" \ +## -u "//x:project/x:parent[x:artifactId='sdk-platform-java-config']/x:version" \ +## -v "${SHARED_DEPS_VERSION}" \ +## "${pom}" +# fi +# done +# +# # Print out the dependency tree for all module to ensure latest protobuf was installed +# mvn dependency:tree +#fi +# +## Reset back to the original Java version if changed +#export JAVA_HOME="${current_java_home}" +#export PATH=${JAVA_HOME}/bin:$PATH + # attempt to install 3 times with exponential backoff (starting with 10 seconds) retry_with_backoff 3 10 \ mvn install -B -V -ntp \ @@ -60,14 +138,30 @@ javadoc) RETURN_CODE=$? ;; integration) - mvn -B ${INTEGRATION_TEST_ARGS} \ - -ntp \ - -Penable-integration-tests \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify +# mvn -B ${INTEGRATION_TEST_ARGS} \ +# -ntp \ +# -Penable-integration-tests \ +# -DtrimStackTrace=false \ +# -Dclirr.skip=true \ +# -Denforcer.skip=true \ +# -fae \ +# verify + + repo="git@github.com:googleapis/java-bigquery.git" + repo_name=$(basename "${repo}" .git) + echo "${repo_name}" + git clone "${repo}" + pushd "${repo_name}" + pwd + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + mvn clean verify -Penable-integration-tests -Dclirr.skip=true -Denforcer.skip=true + popd RETURN_CODE=$? ;; graalvm)