Skip to content

Commit 788bb17

Browse files
dblockgetsaurabh02
authored andcommitted
Run CI/CD on Java 8, 11, 14 and 17. (opensearch-project#121)
* Run CI/CD on Java 8, 11, 14 and 17. Signed-off-by: Daniel Doubrovkine (dB.) <dblock@dblock.org> * Add JDK 17. Signed-off-by: Daniel Doubrovkine (dB.) <dblock@dblock.org>
1 parent 0c402c2 commit 788bb17

4 files changed

Lines changed: 58 additions & 8 deletions

File tree

.github/workflows/ci-17.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and Test
2+
on:
3+
push:
4+
branches:
5+
- "*"
6+
pull_request:
7+
branches:
8+
- "*"
9+
10+
jobs:
11+
build:
12+
13+
name: Build and Test (17)
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Setup Java 11
21+
uses: actions/setup-java@v2
22+
with:
23+
distribution: 'temurin'
24+
java-version: 11
25+
26+
- name: Build
27+
run: |
28+
./gradlew build --build-cache
29+
30+
- name: Setup Java 17
31+
uses: actions/setup-java@v2
32+
with:
33+
distribution: 'temurin'
34+
java-version: 17
35+
36+
- name: Test
37+
run: |
38+
./gradlew test --build-cache
39+
40+

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ jobs:
1111
build:
1212
strategy:
1313
matrix:
14-
java: [14]
14+
java:
15+
- 8
16+
- 11
17+
- 14
1518

1619
name: Build and Test
1720
runs-on: ubuntu-latest
@@ -25,7 +28,6 @@ jobs:
2528
with:
2629
java-version: ${{ matrix.java }}
2730

28-
# common-utils
2931
- name: Build and Test
3032
run: |
3133
./gradlew build

DEVELOPER_GUIDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- [Developer Guide](#developer-guide)
22
- [Forking and Cloning](#forking-and-cloning)
33
- [Install Prerequisites](#install-prerequisites)
4-
- [JDK 14](#jdk-14)
4+
- [JDK 11](#jdk-11)
55
- [Building](#building)
66
- [Using IntelliJ IDEA](#using-intellij-idea)
77
- [Submitting Changes](#submitting-changes)
@@ -16,9 +16,9 @@ Fork this repository on GitHub, and clone locally with `git clone`.
1616

1717
### Install Prerequisites
1818

19-
#### JDK 14
19+
#### JDK 11
2020

21-
OpenSearch components build using Java 14 at a minimum. This means you must have a JDK 14 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 14 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-14`.
21+
OpenSearch components build using Java 11 at a minimum. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`.
2222

2323
### Building
2424

src/test/java/org/opensearch/commons/InjectSecurityTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import static org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_USE_INJECTED_USER_FOR_PLUGINS;
1616

1717
import java.util.Arrays;
18-
import java.util.Map;
18+
import java.util.HashMap;
1919

2020
import org.junit.jupiter.api.Test;
2121
import org.opensearch.common.settings.Settings;
@@ -114,7 +114,11 @@ public void testInjectProperty() {
114114
assertTrue(helper.injectProperty("property1", true));
115115
assertTrue(helper.injectProperty("property2", "some value"));
116116
assertTrue(helper.injectProperty("property3", ""));
117-
assertTrue(helper.injectProperty("property4", Map.of("key", "value")));
117+
assertTrue(helper.injectProperty("property4", new HashMap<String, String>() {
118+
{
119+
put("key", "value");
120+
}
121+
}));
118122
// verify the set properties are not null and equal to what was set
119123
assertNull(threadContext.getTransient("property"));
120124
assertNotNull(threadContext.getTransient("property1"));
@@ -124,7 +128,11 @@ public void testInjectProperty() {
124128
assertNotNull(threadContext.getTransient("property3"));
125129
assertEquals("", threadContext.getTransient("property3"));
126130
assertNotNull(threadContext.getTransient("property4"));
127-
assertEquals(Map.of("key", "value"), threadContext.getTransient("property4"));
131+
assertEquals(new HashMap<String, String>() {
132+
{
133+
put("key", "value");
134+
}
135+
}, threadContext.getTransient("property4"));
128136
}
129137
assertEquals("1", threadContext.getHeader("default"));
130138
assertEquals("opendistro", threadContext.getHeader("name"));

0 commit comments

Comments
 (0)