Skip to content

Commit a53fb16

Browse files
chore: Java 8 unit test to build code in Java 17 and run tests on Java 8 (#1800) (#1381)
* Our Java projects are configured to produce Java 8-compatible bytecode via https://togithub.com/googleapis/java-shared-config/blob/main/pom.xml#L848. This unit test change ensures this config is applied correctly. * For the repositories that mark "dependencies (8)" and "dependencies (11)" as required, they should point to only "dependencies (17)" via `.github/sync-repo-settings.yaml` and repo's Settings tab. Source-Link: https://togithub.com/googleapis/synthtool/commit/cbe010084fc59dc15730c86e9b8e03ddac1de050 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:32851debfefed2b66038e0141f1b5c2103bb59ba80b7475adbc10ef7abab3de7
1 parent 54a4674 commit a53fb16

File tree

5 files changed

+32
-10
lines changed

5 files changed

+32
-10
lines changed

‎.github/.OwlBot.lock.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
16-
digest: sha256:c33bd13e1eab022b0499a3afbfb4b93ae10cb8ad89d8203a6343a88b1b78400f
17-
# created: 2023-06-21T18:48:32.287298785Z
16+
digest: sha256:32851debfefed2b66038e0141f1b5c2103bb59ba80b7475adbc10ef7abab3de7
17+
# created: 2023-06-22T15:06:52.039318836Z

‎.github/sync-repo-settings.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ branchProtectionRules:
88
requiresCodeOwnerReviews: true
99
requiresStrictStatusChecks: false
1010
requiredStatusCheckContexts:
11-
- dependencies (8)
12-
- dependencies (11)
11+
- dependencies (17)
1312
- lint
1413
- clirr
1514
- units (8)

‎.github/workflows/ci.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
java: [8, 11, 17]
28+
java: [11, 17]
2929
steps:
3030
- uses: actions/checkout@v3
3131
- uses: actions/setup-java@v3
@@ -36,6 +36,28 @@ jobs:
3636
- run: .kokoro/build.sh
3737
env:
3838
JOB_TYPE: test
39+
units-java8:
40+
# Building using Java 17 and run the tests with Java 8 runtime
41+
name: "units (8)"
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
- uses: actions/setup-java@v3
46+
with:
47+
java-version: 8
48+
distribution: zulu
49+
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
50+
# Maven surefire plugin (unit tests) allows us to specify JVM to run the tests.
51+
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
52+
run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV
53+
shell: bash
54+
- uses: actions/setup-java@v3
55+
with:
56+
java-version: 17
57+
distribution: zulu
58+
- run: .kokoro/build.sh
59+
env:
60+
JOB_TYPE: test
3961
windows:
4062
runs-on: windows-latest
4163
steps:
@@ -54,7 +76,7 @@ jobs:
5476
runs-on: ubuntu-latest
5577
strategy:
5678
matrix:
57-
java: [8, 11, 17]
79+
java: [17]
5880
steps:
5981
- uses: actions/checkout@v3
6082
- uses: actions/setup-java@v3

‎.kokoro/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ set +e
4747

4848
case ${JOB_TYPE} in
4949
test)
50-
mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true
50+
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
51+
mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true ${SUREFIRE_JVM_OPT}
5152
RETURN_CODE=$?
5253
;;
5354
lint)

‎README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ implementation 'com.google.cloud:google-cloud-logging'
5959
If you are using Gradle without BOM, add this to your dependencies:
6060

6161
```Groovy
62-
implementation 'com.google.cloud:google-cloud-logging:3.15.3'
62+
implementation 'com.google.cloud:google-cloud-logging:3.15.4'
6363
```
6464

6565
If you are using SBT, add this to your dependencies:
6666

6767
```Scala
68-
libraryDependencies += "com.google.cloud" % "google-cloud-logging" % "3.15.3"
68+
libraryDependencies += "com.google.cloud" % "google-cloud-logging" % "3.15.4"
6969
```
7070
<!-- {x-version-update-end} -->
7171

@@ -452,7 +452,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
452452
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-logging/java11.html
453453
[stability-image]: https://img.shields.io/badge/stability-stable-green
454454
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-logging.svg
455-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-logging/3.15.3
455+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-logging/3.15.4
456456
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
457457
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
458458
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

0 commit comments

Comments
 (0)