Skip to content

Commit 98625f6

Browse files
authored
test: adding java 7 check (#1847)
* test: adding java 7 build * required check config
1 parent 91c46a9 commit 98625f6

File tree

4 files changed

+67
-1
lines changed

4 files changed

+67
-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: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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/[email protected]
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+
52+
# Why are these modules are skipped?
53+
# google-http-client-jackson2 and google-http-client-appengine do not work with Java 7
54+
# any more because of Jackson and appengine library are compiled for Java 8.
55+
# dailymotion-simple-cmdline-sample and google-http-client-assembly depend on
56+
# google-http-client-jackson2
57+
mvn --batch-mode --show-version -ntp test \
58+
--projects '!google-http-client-jackson2,!google-http-client-appengine,!samples/dailymotion-simple-cmdline-sample,!google-http-client-assembly' \
59+
-Dclirr.skip=true -Denforcer.skip=true -Dmaven.javadoc.skip=true \
60+
-Dgcloud.download.skip=true -T 1C \
61+
-Dproject.surefire.version=2.22.2 \
62+
-Djvm=${JAVA7_HOME}/bin/java

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ content. The JSON and XML libraries are also fully pluggable, and they include s
1818
The library supports the following Java environments:
1919

2020
- Java 7 or higher
21+
- The google-http-client-jackson2 and google-http-client-appengine modules require Java 8 or
22+
higher due to their dependencies.
2123
- Android 4.4 (Kit Kat)
2224
- GoogleAppEngine Google App Engine
2325

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@
326326
</plugin>
327327
<plugin>
328328
<artifactId>maven-surefire-plugin</artifactId>
329-
<version>3.0.0-M7</version>
329+
<version>${project.surefire.version}</version>
330330
<configuration>
331331
<argLine>-Xmx1024m</argLine>
332332
<reportNameSuffix>sponge_log</reportNameSuffix>
@@ -581,6 +581,7 @@
581581
<project.httpcore.version>4.4.16</project.httpcore.version>
582582
<project.opencensus.version>0.31.1</project.opencensus.version>
583583
<project.root-directory>..</project.root-directory>
584+
<project.surefire.version>3.0.0-M7</project.surefire.version>
584585
<deploy.autorelease>false</deploy.autorelease>
585586
</properties>
586587

0 commit comments

Comments
 (0)