Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 71 additions & 63 deletions .github/workflows/sdk-platform-java-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ jobs:
cache: maven
- run: java -version
- name: Unit Tests
run: |
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip -DenableTestCoverage
working-directory: sdk-platform-java
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: test
# The `envVarTest` profile runs tests that require an environment variable
- name: Env Var Tests
run: |
Expand All @@ -49,10 +50,12 @@ jobs:
GOOGLE_SDK_JAVA_LOGGING: true
working-directory: sdk-platform-java
- run: bazelisk version
- name: Install Maven modules
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip
working-directory: sdk-platform-java
- name: Install all modules using Java 11
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: install
- name: Integration Tests
run: |
bazelisk --batch test //sdk-platform-java/test/integration/...
Expand Down Expand Up @@ -89,26 +92,29 @@ jobs:
cache: maven
- run: java -version
- name: Unit Tests
run: |
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip -DenableTestCoverage
working-directory: sdk-platform-java
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: test
# The `envVarTest` profile runs tests that require an environment variable
- name: Env Var Tests
run: |
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip -DenableTestCoverage -PenvVarTest
# Set the Env Var for this step only
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: test
SUREFIRE_JVM_OPT: '-PenvVarTest'
GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com
GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS: true
GOOGLE_SDK_JAVA_LOGGING: true
working-directory: sdk-platform-java
- run: bazelisk version
- name: Install Maven modules
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
working-directory: sdk-platform-java
- name: Install all modules using Java 11
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: install
- name: Integration Tests
run: |
bazelisk --batch test //sdk-platform-java/test/integration/...
Expand All @@ -127,26 +133,29 @@ jobs:
cache: maven
- run: java -version
- name: Unit Tests
run: |
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip -DenableTestCoverage
working-directory: sdk-platform-java
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: test
# The `envVarTest` profile runs tests that require an environment variable
- name: Env Var Tests
run: |
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip -DenableTestCoverage -PenvVarTest
# Set the Env Var for this step only
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: test
SUREFIRE_JVM_OPT: '-PenvVarTest'
GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com
GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS: true
GOOGLE_SDK_JAVA_LOGGING: true
working-directory: sdk-platform-java
- run: bazelisk version
- name: Install Maven modules
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip
working-directory: sdk-platform-java
- name: Install all modules using Java 11
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: install
- name: Integration Tests
# note need to set shouldInstallTestSecurityManager=false due to https://github.com/bazelbuild/bazel/issues/24354
run: |
Expand Down Expand Up @@ -215,9 +224,10 @@ jobs:
cache: maven
- name: Install all modules using Java 11
shell: bash
run: |
mvn -V -B -ntp clean install -DskipTests -Dfmt.skip -Dcheckstyle.skip
working-directory: sdk-platform-java
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: install
- uses: actions/setup-java@v3
with:
java-version: 8
Expand Down Expand Up @@ -265,9 +275,10 @@ jobs:
cache: maven
- name: Install all modules using Java 11
shell: bash
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip
working-directory: sdk-platform-java
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: install
- uses: actions/setup-java@v3
with:
java-version: 8
Expand Down Expand Up @@ -339,9 +350,11 @@ jobs:
distribution: temurin
- run: mvn -version
- name: Install Maven modules
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip
working-directory: sdk-platform-java
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: test
- name: Showcase golden tests
working-directory: sdk-platform-java/java-showcase
run: |
Expand Down Expand Up @@ -418,9 +431,11 @@ jobs:
distribution: temurin
cache: maven
- name: Install Maven modules
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip
working-directory: sdk-platform-java
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: install
- name: Install showcase to local maven repository
run: |
mvn install -B -ntp -T 1C -DskipTests
Expand Down Expand Up @@ -454,20 +469,11 @@ jobs:
distribution: temurin
cache: maven
- name: Install Maven modules to local Maven repository
run: |
mvn install \
-B -ntp \
-Dorg.slf4j.simpleLogger.showDateTime=true \
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
-DskipTests \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dcheckstyle.skip=true \
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
-Dmaven.wagon.http.retryHandler.count=5 \
-T 1C
working-directory: sdk-platform-java
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: install
- name: Validate gapic-generator-java-bom
uses: googleapis/java-cloud-bom/tests/validate-bom@47ad868794c5d38ee7eb95d69371a7a79f84d890
with:
Expand All @@ -491,9 +497,11 @@ jobs:
mvn test --batch-mode --no-transfer-progress
working-directory: sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check
- name: Install Maven modules
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip
working-directory: sdk-platform-java
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: test
- name: Unmanaged dependency check
uses: ./sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check
with:
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/sdk-platform-java-downstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,9 @@ jobs:
matrix:
repo:
- java-bigtable
- java-bigquery
- java-firestore
- java-pubsub
- java-pubsublite
- java-spanner-jdbc
- java-spanner
- java-storage
- java-storage-nio
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
Expand All @@ -52,9 +47,9 @@ jobs:
sudo apt-get update
sudo apt-get -y install libxml2-utils
- name: Test helper scripts
run: ./sdk-platform-java/.kokoro/presubmit/common_test.sh
run: .kokoro/common_test.sh
- name: Perform downstream compatibility testing
run: REPOS_UNDER_TEST="${{ matrix.repo }}" ./sdk-platform-java/.kokoro/presubmit/downstream-compatibility.sh
run: REPOS_UNDER_TEST="${{ matrix.repo }}" .kokoro/downstream-compatibility.sh
downstream-compatibility-spring-generator:
needs: filter
if: ${{ needs.filter.outputs.library == 'true' }}
Expand All @@ -73,4 +68,4 @@ jobs:
sudo apt-get update
sudo apt-get -y install libxml2-utils
- name: Perform downstream compatibility testing
run: ./sdk-platform-java/.kokoro/presubmit/downstream-compatibility-spring.sh
run: .kokoro/downstream-compatibility-spring.sh
104 changes: 104 additions & 0 deletions .kokoro/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

commonScriptDir=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
excluded_modules=(
'gapic-libraries-bom'
'google-cloud-jar-parent'
Expand All @@ -32,6 +33,7 @@ excluded_modules=(
'java-spanner'
'java-spanner-jdbc'
'google-auth-library-java'
'google-auth-library-java/oauth2_http'
'java-storage'
'java-storage-nio'
)
Expand Down Expand Up @@ -305,6 +307,7 @@ function run_integration_tests() {
${INTEGRATION_TEST_ARGS} \
-B -ntp -fae \
--also-make \
-PbulkTests \
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
Expand Down Expand Up @@ -419,6 +422,10 @@ function install_modules() {
printf "Installing submodules:\n%s\n" "$all_submodules"

always_install_deps_list=(
'google-auth-library-java/appengine'
'google-auth-library-java/bom'
'google-auth-library-java/credentials'
'google-auth-library-java/oauth2_http'
'sdk-platform-java/java-shared-dependencies'
'sdk-platform-java/java-shared-dependencies/first-party-dependencies'
'sdk-platform-java/java-shared-dependencies/third-party-dependencies'
Expand Down Expand Up @@ -478,3 +485,100 @@ function install_modules() {
-T 1C
fi
}


# In the given directory ($1),
# update the pom.xml's dependency on the given artifact ($2) to the given version ($3)
# ex: update_dependency google-cloud-java/google-cloud-jar-parent google-cloud-shared-dependencies 1.2.3
function update_pom_dependency {
pushd "$1" || exit 1
xmllint --shell pom.xml &>/dev/null <<EOF
setns x=http://maven.apache.org/POM/4.0.0
cd .//x:artifactId[text()="$2"]
cd ../x:version
set $3
save pom.xml
EOF
popd || exit 1
}

# Find all pom.xml files that declare a specific version for the given artifact ($1)
function find_all_poms_with_versioned_dependency {
poms=($(find . -name pom.xml))
for pom in "${poms[@]}"; do
if xmllint --xpath "//*[local-name()='artifactId' and text()='$1']/following-sibling::*[local-name()='version']" "$pom" &>/dev/null; then
found+=("$pom")
fi
done
POMS=(${found[@]})
unset found
export POMS
}

# In the given directory ($1),
# find and update all pom.xmls' dependencies on the given artifact ($2) to the given version ($3)
# ex: update_all_poms_dependency google-cloud-java google-cloud-shared-dependencies 1.2.3
function update_all_poms_dependency {
pushd "$1" || exit 1
find_all_poms_with_versioned_dependency "$2"
for pom in $POMS; do
update_pom_dependency "$(dirname "$pom")" "$2" "$3"
done
git diff
popd || exit 1
}

# Parse the version of the pom.xml file in the given directory ($1)
# ex: VERSION=$(parse_pom_version java-shared-dependencies)
function parse_pom_version {
# Namespace (xmlns) prevents xmllint from specifying tag names in XPath
result=$(sed -e 's/xmlns=".*"//' "$1/pom.xml" | xmllint --xpath '/project/version/text()' -)

if [ -z "${result}" ]; then
echo "Version is not found in $1"
exit 1
fi
echo "$result"
}

# ex: find_last_release_version java-bigtable
# ex: find_last_release_version java-storage 2.22.x
function find_last_release_version {
repo=$1
branch=${2-"main"} # Default to using main branch
org=${3-"googleapis"}
curl -s -o "versions_${repo}.txt" "https://raw.githubusercontent.com/${org}/${repo}/${branch}/versions.txt"

# First check to see if there's an entry for the overall repo. Used for google-cloud-java.
primary_artifact=$(grep -E "^${repo}" "versions_${repo}.txt" | head -n 1)
if [ -z "${primary_artifact}" ]; then
# Otherwise, use the first google-cloud-* artifact's version.
primary_artifact=$(grep -E "^google-cloud-" "versions_$1.txt" | head -n 1)
fi
if [ -z "${primary_artifact}" ]; then
echo "Unable to identify primary artifact for $1"
exit 1
fi

parts=($(echo "$primary_artifact" | tr ":" "\n"))
echo "${parts[1]}"
}

# copies settings.xml from the root of sdk-platform-java into Maven's home
# folder
function setup_maven_mirror {
echo "Setup maven mirror"
mkdir -p "${HOME}/.m2"
cp "${commonScriptDir}/../settings.xml" "${HOME}/.m2"
}

function install_repo_modules {
target_projects="$1"
projects_arg=""
if [ -n "${target_projects}" ]; then
projects_arg="--projects ${target_projects}"
fi
echo "Installing this repo's modules to local maven."
mvn -q -B -ntp install ${projects_arg} \
-Dcheckstyle.skip -Dfmt.skip -DskipTests -T 1C
}
Loading
Loading