From 629bd510c1a044015bcb28b164bf93826ac4a4d7 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Fri, 19 Mar 2021 15:03:00 +0100 Subject: [PATCH 1/5] Update JDKs used by CI to the latest versions --- .github/workflows/maven-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index fa07eabc3e..7a942ab70d 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 13 ] + java: [ 16 ] steps: - uses: actions/checkout@v2 - name: Set up JDK @@ -51,7 +51,7 @@ jobs: strategy: matrix: os: [ ubuntu, windows ] - java: [ 8, 11, 13, 15-ea ] + java: [ 8, 11, 16 ] steps: - uses: actions/checkout@v2 - name: Set up JDK From 34a1f9d6e4723cf766d70e0d10b2124c858fa4e4 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Fri, 19 Mar 2021 15:04:25 +0100 Subject: [PATCH 2/5] Disable fail-fast for matrix builds --- .github/workflows/maven-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 7a942ab70d..3f08670b28 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -8,6 +8,7 @@ jobs: name: build-only (Java ${{ matrix.java }}) runs-on: ubuntu-latest strategy: + fail-fast: false matrix: java: [ 16 ] steps: @@ -29,6 +30,7 @@ jobs: name: site (Java ${{ matrix.java }}) runs-on: ubuntu-latest strategy: + fail-fast: false matrix: java: [ 8, 11 ] steps: @@ -49,6 +51,7 @@ jobs: name: test (${{ matrix.os }}, Java ${{ matrix.java }}) runs-on: ${{ matrix.os }}-latest strategy: + fail-fast: false matrix: os: [ ubuntu, windows ] java: [ 8, 11, 16 ] From ea3cbd4c714f368c8539677afed7fabb3480feb3 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Fri, 19 Mar 2021 15:43:11 +0100 Subject: [PATCH 3/5] Pass appropriate MAVEN_OPTS for JDK 11+ They are required by spotless starting JDK 16+ --- .github/workflows/maven-build.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 3f08670b28..8a2b59f8d8 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -2,6 +2,9 @@ name: CI on: [push, pull_request] +# this is required by spotless for JDK 16+ +env: + JAVA_11_PLUS_MAVEN_OPTS: "--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" jobs: build: @@ -25,6 +28,8 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - name: Maven Install (skipTests) + env: + MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} run: mvn -B install -DskipTests -D enable-ci --file pom.xml site: name: site (Java ${{ matrix.java }}) @@ -67,9 +72,21 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- + # JDK 8 - name: Maven Install without Code Coverage - if: matrix.os == 'windows' + if: matrix.os == 'windows' && matrix.java == '8' run: mvn -B install --file pom.xml - name: Maven Install with Code Coverage - if: matrix.os != 'windows' + if: matrix.os != 'windows' && matrix.java == '8' + run: mvn -B install -D enable-ci --file pom.xml + # JDK 11+ + - name: Maven Install without Code Coverage + if: matrix.os == 'windows' && matrix.java != '8' + env: + MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} + run: mvn -B install --file pom.xml + - name: Maven Install with Code Coverage + if: matrix.os != 'windows' && matrix.java != '8' + env: + MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} run: mvn -B install -D enable-ci --file pom.xml From 8a3559ada53bc4ceef2b4ddec46653dfdb9a2038 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Fri, 19 Mar 2021 16:09:18 +0100 Subject: [PATCH 4/5] Open java.net to unnamed modules This is needed to inject the unsupported HTTP verb. I don't know really if we will be able to find a better option than that... --- pom.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pom.xml b/pom.xml index e18e28a7fc..cef2825cef 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,8 @@ false 0.11.2 + + @@ -272,6 +274,7 @@ default-test src/test/resources/slow-or-flaky-tests.txt + ${surefire.argLine} @@ -284,6 +287,7 @@ 2 src/test/resources/slow-or-flaky-tests.txt + ${surefire.argLine} @@ -561,6 +565,16 @@ + + jdk11+ + + [11,) + + + + --add-opens java.base/java.net=ALL-UNNAMED + + ci-non-windows From 6e1b943823c550f100e54186a0c00df5c6284404 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Fri, 19 Mar 2021 16:36:44 +0100 Subject: [PATCH 5/5] Disable tests messing with the environment for Java 16+ It might be possible to make them work again but it will require some more advanced surgery. --- .../org/kohsuke/github/GitHubConnectionTest.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/kohsuke/github/GitHubConnectionTest.java b/src/test/java/org/kohsuke/github/GitHubConnectionTest.java index 0fb168eae8..98be781faf 100644 --- a/src/test/java/org/kohsuke/github/GitHubConnectionTest.java +++ b/src/test/java/org/kohsuke/github/GitHubConnectionTest.java @@ -1,13 +1,20 @@ package org.kohsuke.github; +import org.junit.Assume; import org.junit.Test; import org.kohsuke.github.authorization.UserAuthorizationProvider; import java.io.IOException; import java.lang.reflect.Field; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.lessThan; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; /** * Unit test for {@link GitHub}. @@ -56,6 +63,8 @@ public void testGitHubServerWithoutServer() throws Exception { @Test public void testGitHubBuilderFromEnvironment() throws IOException { + // we disable this test for JDK 16+ as the current hacks in setupEnvironment() don't work with JDK 16+ + Assume.assumeThat(Double.valueOf(System.getProperty("java.specification.version")), lessThan(16.0)); Map props = new HashMap(); @@ -98,6 +107,9 @@ public void testGitHubBuilderFromEnvironment() throws IOException { @Test public void testGitHubBuilderFromCustomEnvironment() throws IOException { + // we disable this test for JDK 16+ as the current hacks in setupEnvironment() don't work with JDK 16+ + Assume.assumeThat(Double.valueOf(System.getProperty("java.specification.version")), lessThan(16.0)); + Map props = new HashMap(); props.put("customEndpoint", "bogus endpoint url");