Skip to content

Commit cb87aa9

Browse files
chore: Java 8 unit test to build code in Java 17 and run tests on Java 8 (googleapis#1800) (googleapis#1628)
* chore: Java 8 unit test to build code in Java 17 and run tests on Java 8 (googleapis#1800) * Our Java projects are configured to produce Java 8-compatible bytecode via https://github.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: googleapis/synthtool@cbe0100 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:32851debfefed2b66038e0141f1b5c2103bb59ba80b7475adbc10ef7abab3de7 * dependencies (17) --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Tomo Suzuki <[email protected]>
1 parent b444a9d commit cb87aa9

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
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:af2eda87a54601ae7b7b2be5055c17b43ac98a7805b586772db314de8a7d4a1d
17-
# created: 2023-06-16T02:10:09.149325782Z
16+
digest: sha256:32851debfefed2b66038e0141f1b5c2103bb59ba80b7475adbc10ef7abab3de7
17+
# created: 2023-06-22T15:06:52.039318836Z

.github/dependabot.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ updates:
66
interval: "daily"
77
# Disable version updates for Maven dependencies
88
# we use renovate-bot as well as shared-dependencies BOM to update maven dependencies.
9-
ignore: "*"
9+
ignore:
10+
- dependency-name: "*"
1011
- package-ecosystem: "pip"
1112
directory: "/"
1213
schedule:
1314
interval: "daily"
1415
# Disable version updates for pip dependencies
1516
# If a security vulnerability comes in, we will be notified about
1617
# it via template in the synthtool repository.
17-
ignore: "*"
18+
ignore:
19+
- dependency-name: "*"

.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 -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)

0 commit comments

Comments
 (0)