Skip to content
Open
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
232 changes: 124 additions & 108 deletions .github/workflows/sdk-platform-java-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
branches:
- main
pull_request:
name: sdk-platform-java-ci
name: sdk-platform-java
jobs:
filter:
runs-on: ubuntu-latest
Expand All @@ -18,14 +18,15 @@ jobs:
library:
- 'sdk-platform-java/**'
- 'google-auth-library-java/**'
- '.github/workflows/ci.yaml'
build:
- '.github/workflows/sdk-platform-java-ci.yaml'
units:
needs: filter
if: ${{ needs.filter.outputs.library == 'true' }}
runs-on: ubuntu-22.04
name: sdk-platform-java units
strategy:
matrix:
java: [ 11, 17 ]
java: [ 11, 17, 21, 25 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
Expand All @@ -51,67 +52,79 @@ jobs:
GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS: true
GOOGLE_SDK_JAVA_LOGGING: true
working-directory: sdk-platform-java
- run: bazelisk version
- 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/...
- name: Gradle Build Generated Storage Client Library
run: |
echo "Building Storage lib from generated source..."
mkdir /tmp/java-storage
bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
pushd /tmp/java-storage/google-cloud-storage-v2-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
- name: Gradle Build Generated Compute Client Library
run: |
echo "Building Compute lib from generated source..."
mkdir /tmp/java-compute
bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
build-java-21:

sdk-platform-java-8:
needs: filter
if: ${{ needs.filter.outputs.library == 'true' }}
name: "build(21) except self-service clients"
# Support for Java 21 is available for all use cases except self-service clients.
name: "sdk-platform-java units (8)"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# Java 8 tests uses JDK 17 to compile and JDK 8 to run tests.
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 8
distribution: temurin
cache: maven
- run: java -version
- name: Unit Tests
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Install all modules using Java 17
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: test
JOB_TYPE: install
- name: Run tests with Java 8
shell: bash
run: |
set -x
export JAVA_HOME=$JAVA_HOME
export PATH=${JAVA_HOME}/bin:$PATH
# Maven surefire plugin lets us to specify the JVM when running tests via
# the "jvm" system property.
mvn verify --batch-mode --no-transfer-progress -Pquick-build \
-Djvm="${JAVA8_HOME}/bin/java"
working-directory: sdk-platform-java
# The `envVarTest` profile runs tests that require an environment variable
- name: Env Var Tests
- name: Run tests with Java 8 (Env Var Tests)
shell: bash
run: .kokoro/build.sh
run: |
set -x
export JAVA_HOME=$JAVA_HOME
export PATH=${JAVA_HOME}/bin:$PATH
# Maven surefire plugin lets us to specify the JVM when running tests via
# the "jvm" system property.
export GOOGLE_CLOUD_UNIVERSE_DOMAIN=random.com
mvn test --batch-mode --no-transfer-progress -Pquick-build \
-DenableTestCoverage -Dsurefire.failIfNoSpecifiedTests=false \
-PenvVarTest
# Set the Env Var for this step only
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

bazel:
needs: filter
if: ${{ needs.filter.outputs.library == 'true' }}
runs-on: ubuntu-22.04
name: sdk-platform-java integration
strategy:
matrix:
java: [ 11, 17, 21 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
cache: maven
- run: bazelisk version
- name: Install all modules using Java 11
- name: Install all modules
shell: bash
run: .kokoro/build.sh
env:
Expand All @@ -120,107 +133,76 @@ jobs:
- name: Integration Tests
run: |
bazelisk --batch test //sdk-platform-java/test/integration/...
build-java-25:

bazel-25:
needs: filter
if: ${{ needs.filter.outputs.library == 'true' }}
name: "build(25) except self-service clients"
# Support for Java 25 is available for all use cases except self-service clients.
runs-on: ubuntu-22.04
name: sdk-platform-java integration (25)
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 25
distribution: temurin
cache: maven
- run: java -version
- name: Unit Tests
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
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
- run: bazelisk version
- name: Install all modules using Java 11
- name: Install all modules
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: |
bazelisk --batch test //sdk-platform-java/test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false
build-java8-except-gapic-generator-java:

self-service:
needs: filter
if: ${{ needs.filter.outputs.library == 'true' }}
name: "build(8) except for gapic-generator-java"
runs-on: ubuntu-22.04
name: sdk-platform-java self-service clients
strategy:
matrix:
java: [ 11, 17 ]
steps:
- uses: actions/checkout@v4
# Java 8 tests uses JDK 17 to compile and JDK 8 to run tests.
- uses: actions/setup-java@v4
with:
java-version: 8
java-version: ${{ matrix.java }}
distribution: temurin
cache: maven
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Install all modules using Java 17
- run: bazelisk version
- name: Install all modules using Java 11
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: install
- name: Run tests with Java 8
shell: bash
- name: Gradle Build Generated Storage Client Library
run: |
set -x
export JAVA_HOME=$JAVA_HOME
export PATH=${JAVA_HOME}/bin:$PATH
# Maven surefire plugin lets us to specify the JVM when running tests via
# the "jvm" system property.
mvn verify --batch-mode --no-transfer-progress -Pquick-build \
-Djvm="${JAVA8_HOME}/bin/java"
working-directory: sdk-platform-java
# The `envVarTest` profile runs tests that require an environment variable
- name: Run tests with Java 8 (Env Var Tests)
shell: bash
echo "Building Storage lib from generated source..."
mkdir /tmp/java-storage
bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
pushd /tmp/java-storage/google-cloud-storage-v2-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
- name: Gradle Build Generated Compute Client Library
run: |
set -x
export JAVA_HOME=$JAVA_HOME
export PATH=${JAVA_HOME}/bin:$PATH
# Maven surefire plugin lets us to specify the JVM when running tests via
# the "jvm" system property.
export GOOGLE_CLOUD_UNIVERSE_DOMAIN=random.com
mvn test --batch-mode --no-transfer-progress -Pquick-build \
-DenableTestCoverage -Dsurefire.failIfNoSpecifiedTests=false \
-PenvVarTest
# Set the Env Var for this step only
env:
GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com
GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS: true
GOOGLE_SDK_JAVA_LOGGING: true
working-directory: sdk-platform-java
echo "Building Compute lib from generated source..."
mkdir /tmp/java-compute
bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd


build-java8-gapic-generator-java:
gapic-generator-java:
needs: filter
if: ${{ needs.filter.outputs.library == 'true' }}
name: "build(8) for gapic-generator-java"
name: "gapic-generator-java (8)"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -267,6 +249,40 @@ jobs:
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd

java8-compatibility:
needs: filter
if: ${{ needs.filter.outputs.library == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: maven
- name: Install sdk-platform-modules to local Maven repository
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: sdk-platform-java
JOB_TYPE: install
- name: Check Java 8 compatibility for class files
shell: bash
run: |
find . -type f -name "*.class" -path "*/classes/*" \
-not -path "*/grpc-*/*" \
-not -path "*/proto-*/*" \
-not -path "*/gapic-generator-java/*" -print |\
while IFS= read -r class_file; do
version=$(javap -v "${class_file}" | grep "major version" | cut -d ' ' -f 5)
if [[ "${version}" != "52" ]]; then
echo "${class_file} is not compatible with Java 8."
exit 1
fi
done
echo "All class files are compatible with Java 8."
working-directory: sdk-platform-java

build-java8-showcase:
needs: filter
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sdk-platform-java-downstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
downstream-compatibility-spring-generator:
needs: filter
if: ${{ needs.filter.outputs.library == 'true' }}
name: "downstream-compatibility (spring-cloud-gcp)"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
Expand Down
Loading
Loading