Skip to content

Commit c17c77c

Browse files
committed
test: adding Java 7 check
Using the same method as googleapis/google-http-java-client#1847 to use surefire's jvm system property
1 parent 240564a commit c17c77c

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.github/sync-repo-settings.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ branchProtectionRules:
88
requiresCodeOwnerReviews: true
99
requiresStrictStatusChecks: false
1010
requiredStatusCheckContexts:
11+
- units (7)
1112
- units (8)
1213
- units (11)
1314
- windows

.github/workflows/ci-java7.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# Github action job to test core java library features on
15+
# downstream client libraries before they are released.
16+
on:
17+
push:
18+
branches:
19+
- main
20+
pull_request:
21+
name: ci-java7
22+
jobs:
23+
units:
24+
name: "units (7)"
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: actions/setup-java@v1
29+
# setup-java v2 or higher does not have version 1.7
30+
with:
31+
version: 1.7
32+
architecture: x64
33+
- run: |
34+
java -version
35+
# This value is used in "-Djvm=" later
36+
echo "JAVA7_HOME=${JAVA_HOME}" >> $GITHUB_ENV
37+
- uses: actions/setup-java@v3
38+
with:
39+
java-version: 17
40+
distribution: temurin
41+
- name: Set up Maven
42+
uses: stCarolas/setup-maven@v4.5
43+
with:
44+
maven-version: 3.8.8
45+
- name: Build
46+
shell: bash
47+
run: |
48+
# Leveraging surefire's jvm option, running the test on Java 7.
49+
# Surefire plugin 2.22.2 is the last version for Java 7. Newer version would fail with
50+
# "UnsupportedClassVersionError: org/apache/maven/surefire/booter/ForkedBooter" error.
51+
mvn --batch-mode --show-version -ntp test \
52+
-Dclirr.skip=true -Denforcer.skip=true -Dmaven.javadoc.skip=true \
53+
-Dgcloud.download.skip=true -T 1C \
54+
-Dproject.surefire.version=2.22.2 \
55+
-Djvm=${JAVA7_HOME}/bin/java

pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
</plugin>
294294
<plugin>
295295
<artifactId>maven-surefire-plugin</artifactId>
296-
<version>3.1.0</version>
296+
<version>${project.surefire.version}</version>
297297
<configuration>
298298
<argLine>-Xmx1024m</argLine>
299299
<reportNameSuffix>sponge_log</reportNameSuffix>
@@ -510,6 +510,8 @@
510510
<project.datanucleus-api-jdo.version>3.2.1</project.datanucleus-api-jdo.version>
511511
<project.datanucleus-maven-plugin.version>4.0.3</project.datanucleus-maven-plugin.version>
512512
<project.servlet-api.version>2.5</project.servlet-api.version>
513+
<!-- Declaring surefire version as property lets us ot specify its version as Maven's argument -->
514+
<project.surefire.version>3.0.0-M7</project.surefire.version>
513515
<deploy.autorelease>false</deploy.autorelease>
514516
<gson.version>2.10.1</gson.version>
515517
</properties>

0 commit comments

Comments
 (0)