33 branches :
44 - main
55 pull_request :
6- name : sdk-platform-java-ci
6+ name : sdk-platform-java
77jobs :
88 filter :
99 runs-on : ubuntu-latest
@@ -18,14 +18,15 @@ jobs:
1818 library:
1919 - 'sdk-platform-java/**'
2020 - 'google-auth-library-java/**'
21- - '.github/workflows/ci.yaml'
22- build :
21+ - '.github/workflows/sdk-platform-java- ci.yaml'
22+ units :
2323 needs : filter
2424 if : ${{ needs.filter.outputs.library == 'true' }}
2525 runs-on : ubuntu-22.04
26+ name : sdk-platform-java units
2627 strategy :
2728 matrix :
28- java : [ 11, 17 ]
29+ java : [ 11, 17, 21, 25 ]
2930 steps :
3031 - uses : actions/checkout@v4
3132 - uses : actions/setup-java@v4
@@ -51,67 +52,79 @@ jobs:
5152 GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS : true
5253 GOOGLE_SDK_JAVA_LOGGING : true
5354 working-directory : sdk-platform-java
54- - run : bazelisk version
55- - name : Install all modules using Java 11
56- shell : bash
57- run : .kokoro/build.sh
58- env :
59- BUILD_SUBDIR : sdk-platform-java
60- JOB_TYPE : install
61- - name : Integration Tests
62- run : |
63- bazelisk --batch test //sdk-platform-java/test/integration/...
64- - name : Gradle Build Generated Storage Client Library
65- run : |
66- echo "Building Storage lib from generated source..."
67- mkdir /tmp/java-storage
68- bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
69- tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
70- pushd /tmp/java-storage/google-cloud-storage-v2-java
71- ./gradlew clean build publishToMavenLocal sourcesJar allJars
72- popd
73- - name : Gradle Build Generated Compute Client Library
74- run : |
75- echo "Building Compute lib from generated source..."
76- mkdir /tmp/java-compute
77- bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
78- tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
79- pushd /tmp/java-compute/google-cloud-compute-small-v1-java
80- ./gradlew clean build publishToMavenLocal sourcesJar allJars
81- popd
82- build-java-21 :
55+
56+ sdk-platform-java-8 :
8357 needs : filter
8458 if : ${{ needs.filter.outputs.library == 'true' }}
85- name : " build(21) except self-service clients"
86- # Support for Java 21 is available for all use cases except self-service clients.
59+ name : " sdk-platform-java units (8)"
8760 runs-on : ubuntu-22.04
8861 steps :
8962 - uses : actions/checkout@v4
63+ # Java 8 tests uses JDK 17 to compile and JDK 8 to run tests.
9064 - uses : actions/setup-java@v4
9165 with :
92- java-version : 21
66+ java-version : 8
9367 distribution : temurin
9468 cache : maven
95- - run : java -version
96- - name : Unit Tests
69+ - run : echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
70+ - uses : actions/setup-java@v3
71+ with :
72+ java-version : 17
73+ distribution : temurin
74+ - name : Install all modules using Java 17
9775 shell : bash
9876 run : .kokoro/build.sh
9977 env :
10078 BUILD_SUBDIR : sdk-platform-java
101- JOB_TYPE : test
79+ JOB_TYPE : install
80+ - name : Run tests with Java 8
81+ shell : bash
82+ run : |
83+ set -x
84+ export JAVA_HOME=$JAVA_HOME
85+ export PATH=${JAVA_HOME}/bin:$PATH
86+ # Maven surefire plugin lets us to specify the JVM when running tests via
87+ # the "jvm" system property.
88+ mvn verify --batch-mode --no-transfer-progress -Pquick-build \
89+ -Djvm="${JAVA8_HOME}/bin/java"
90+ working-directory : sdk-platform-java
10291 # The `envVarTest` profile runs tests that require an environment variable
103- - name : Env Var Tests
92+ - name : Run tests with Java 8 ( Env Var Tests)
10493 shell : bash
105- run : .kokoro/build.sh
94+ run : |
95+ set -x
96+ export JAVA_HOME=$JAVA_HOME
97+ export PATH=${JAVA_HOME}/bin:$PATH
98+ # Maven surefire plugin lets us to specify the JVM when running tests via
99+ # the "jvm" system property.
100+ export GOOGLE_CLOUD_UNIVERSE_DOMAIN=random.com
101+ mvn test --batch-mode --no-transfer-progress -Pquick-build \
102+ -DenableTestCoverage -Dsurefire.failIfNoSpecifiedTests=false \
103+ -PenvVarTest
104+ # Set the Env Var for this step only
106105 env :
107- BUILD_SUBDIR : sdk-platform-java
108- JOB_TYPE : test
109- SUREFIRE_JVM_OPT : ' -PenvVarTest'
110106 GOOGLE_CLOUD_UNIVERSE_DOMAIN : random.com
111107 GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS : true
112108 GOOGLE_SDK_JAVA_LOGGING : true
109+ working-directory : sdk-platform-java
110+
111+ bazel :
112+ needs : filter
113+ if : ${{ needs.filter.outputs.library == 'true' }}
114+ runs-on : ubuntu-22.04
115+ name : sdk-platform-java integration
116+ strategy :
117+ matrix :
118+ java : [ 11, 17, 21 ]
119+ steps :
120+ - uses : actions/checkout@v4
121+ - uses : actions/setup-java@v4
122+ with :
123+ java-version : ${{ matrix.java }}
124+ distribution : temurin
125+ cache : maven
113126 - run : bazelisk version
114- - name : Install all modules using Java 11
127+ - name : Install all modules
115128 shell : bash
116129 run : .kokoro/build.sh
117130 env :
@@ -120,107 +133,76 @@ jobs:
120133 - name : Integration Tests
121134 run : |
122135 bazelisk --batch test //sdk-platform-java/test/integration/...
123- build-java-25 :
136+
137+ bazel-25 :
124138 needs : filter
125139 if : ${{ needs.filter.outputs.library == 'true' }}
126- name : " build(25) except self-service clients"
127- # Support for Java 25 is available for all use cases except self-service clients.
128140 runs-on : ubuntu-22.04
141+ name : sdk-platform-java integration (25)
129142 steps :
130143 - uses : actions/checkout@v4
131144 - uses : actions/setup-java@v4
132145 with :
133146 java-version : 25
134147 distribution : temurin
135148 cache : maven
136- - run : java -version
137- - name : Unit Tests
138- shell : bash
139- run : .kokoro/build.sh
140- env :
141- BUILD_SUBDIR : sdk-platform-java
142- JOB_TYPE : test
143- # The `envVarTest` profile runs tests that require an environment variable
144- - name : Env Var Tests
145- shell : bash
146- run : .kokoro/build.sh
147- env :
148- BUILD_SUBDIR : sdk-platform-java
149- JOB_TYPE : test
150- SUREFIRE_JVM_OPT : ' -PenvVarTest'
151- GOOGLE_CLOUD_UNIVERSE_DOMAIN : random.com
152- GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS : true
153- GOOGLE_SDK_JAVA_LOGGING : true
154149 - run : bazelisk version
155- - name : Install all modules using Java 11
150+ - name : Install all modules
156151 shell : bash
157152 run : .kokoro/build.sh
158153 env :
159154 BUILD_SUBDIR : sdk-platform-java
160155 JOB_TYPE : install
161156 - name : Integration Tests
162- # note need to set shouldInstallTestSecurityManager=false due to https://github.com/bazelbuild/bazel/issues/24354
163157 run : |
164158 bazelisk --batch test //sdk-platform-java/test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false
165- build-java8-except-gapic-generator-java :
159+
160+ self-service :
166161 needs : filter
167162 if : ${{ needs.filter.outputs.library == 'true' }}
168- name : " build(8) except for gapic-generator-java"
169163 runs-on : ubuntu-22.04
164+ name : sdk-platform-java self-service clients
165+ strategy :
166+ matrix :
167+ java : [ 11, 17 ]
170168 steps :
171169 - uses : actions/checkout@v4
172- # Java 8 tests uses JDK 17 to compile and JDK 8 to run tests.
173170 - uses : actions/setup-java@v4
174171 with :
175- java-version : 8
172+ java-version : ${{ matrix.java }}
176173 distribution : temurin
177174 cache : maven
178- - run : echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
179- - uses : actions/setup-java@v3
180- with :
181- java-version : 17
182- distribution : temurin
183- - name : Install all modules using Java 17
175+ - run : bazelisk version
176+ - name : Install all modules using Java 11
184177 shell : bash
185178 run : .kokoro/build.sh
186179 env :
187180 BUILD_SUBDIR : sdk-platform-java
188181 JOB_TYPE : install
189- - name : Run tests with Java 8
190- shell : bash
182+ - name : Gradle Build Generated Storage Client Library
191183 run : |
192- set -x
193- export JAVA_HOME=$JAVA_HOME
194- export PATH=${JAVA_HOME}/bin:$PATH
195- # Maven surefire plugin lets us to specify the JVM when running tests via
196- # the "jvm" system property.
197- mvn verify --batch-mode --no-transfer-progress -Pquick-build \
198- -Djvm="${JAVA8_HOME}/bin/java"
199- working-directory : sdk-platform-java
200- # The `envVarTest` profile runs tests that require an environment variable
201- - name : Run tests with Java 8 (Env Var Tests)
202- shell : bash
184+ echo "Building Storage lib from generated source..."
185+ mkdir /tmp/java-storage
186+ bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
187+ tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
188+ pushd /tmp/java-storage/google-cloud-storage-v2-java
189+ ./gradlew clean build publishToMavenLocal sourcesJar allJars
190+ popd
191+ - name : Gradle Build Generated Compute Client Library
203192 run : |
204- set -x
205- export JAVA_HOME=$JAVA_HOME
206- export PATH=${JAVA_HOME}/bin:$PATH
207- # Maven surefire plugin lets us to specify the JVM when running tests via
208- # the "jvm" system property.
209- export GOOGLE_CLOUD_UNIVERSE_DOMAIN=random.com
210- mvn test --batch-mode --no-transfer-progress -Pquick-build \
211- -DenableTestCoverage -Dsurefire.failIfNoSpecifiedTests=false \
212- -PenvVarTest
213- # Set the Env Var for this step only
214- env :
215- GOOGLE_CLOUD_UNIVERSE_DOMAIN : random.com
216- GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS : true
217- GOOGLE_SDK_JAVA_LOGGING : true
218- working-directory : sdk-platform-java
193+ echo "Building Compute lib from generated source..."
194+ mkdir /tmp/java-compute
195+ bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
196+ tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
197+ pushd /tmp/java-compute/google-cloud-compute-small-v1-java
198+ ./gradlew clean build publishToMavenLocal sourcesJar allJars
199+ popd
200+
219201
220- build-java8- gapic-generator-java :
202+ gapic-generator-java :
221203 needs : filter
222204 if : ${{ needs.filter.outputs.library == 'true' }}
223- name : " build(8) for gapic-generator-java"
205+ name : " gapic-generator-java (8) "
224206 runs-on : ubuntu-22.04
225207 steps :
226208 - uses : actions/checkout@v4
@@ -267,6 +249,40 @@ jobs:
267249 pushd /tmp/java-compute/google-cloud-compute-small-v1-java
268250 ./gradlew clean build publishToMavenLocal sourcesJar allJars
269251 popd
252+
253+ java8-compatibility :
254+ needs : filter
255+ if : ${{ needs.filter.outputs.library == 'true' }}
256+ runs-on : ubuntu-latest
257+ steps :
258+ - uses : actions/checkout@v4
259+ - uses : actions/setup-java@v4
260+ with :
261+ java-version : 17
262+ distribution : temurin
263+ cache : maven
264+ - name : Install sdk-platform-modules to local Maven repository
265+ shell : bash
266+ run : .kokoro/build.sh
267+ env :
268+ BUILD_SUBDIR : sdk-platform-java
269+ JOB_TYPE : install
270+ - name : Check Java 8 compatibility for class files
271+ shell : bash
272+ run : |
273+ find . -type f -name "*.class" -path "*/classes/*" \
274+ -not -path "*/grpc-*/*" \
275+ -not -path "*/proto-*/*" \
276+ -not -path "*/gapic-generator-java/*" -print |\
277+ while IFS= read -r class_file; do
278+ version=$(javap -v "${class_file}" | grep "major version" | cut -d ' ' -f 5)
279+ if [[ "${version}" != "52" ]]; then
280+ echo "${class_file} is not compatible with Java 8."
281+ exit 1
282+ fi
283+ done
284+ echo "All class files are compatible with Java 8."
285+ working-directory : sdk-platform-java
270286
271287 build-java8-showcase :
272288 needs : filter
0 commit comments