Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ 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:
name: build-only (Java ${{ matrix.java }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 13 ]
java: [ 16 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
Expand All @@ -24,11 +28,14 @@ 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 }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 8, 11 ]
steps:
Expand All @@ -49,9 +56,10 @@ jobs:
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows ]
java: [ 8, 11, 13, 15-ea ]
java: [ 8, 11, 16 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
Expand All @@ -64,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
14 changes: 14 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
<!-- For non-ci builds we'd like the build to still complete if jacoco metrics aren't met. -->
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
<jjwt.suite.version>0.11.2</jjwt.suite.version>

<surefire.argLine></surefire.argLine>
</properties>

<build>
Expand Down Expand Up @@ -272,6 +274,7 @@
<id>default-test</id>
<configuration>
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
<argLine>${surefire.argLine}</argLine>
</configuration>
</execution>
<execution>
Expand All @@ -284,6 +287,7 @@
<rerunFailingTestsCount>2</rerunFailingTestsCount>
<!-- There are some tests that take longer or are a little flaky. Run them here. -->
<includesFile>src/test/resources/slow-or-flaky-tests.txt</includesFile>
<argLine>${surefire.argLine}</argLine>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -561,6 +565,16 @@
</pluginRepository>
</pluginRepositories>
<profiles>
<profile>
<id>jdk11+</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<properties>
<!-- this is required for GithubHttpUrlConnectionClient#setRequestMethod() to work with JDK 16+ -->
<surefire.argLine>--add-opens java.base/java.net=ALL-UNNAMED</surefire.argLine>
</properties>
</profile>
<profile>
<id>ci-non-windows</id>
<activation>
Expand Down
16 changes: 14 additions & 2 deletions src/test/java/org/kohsuke/github/GitHubConnectionTest.java
Original file line number Diff line number Diff line change
@@ -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}.
Expand Down Expand Up @@ -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<String, String> props = new HashMap<String, String>();

Expand Down Expand Up @@ -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<String, String> props = new HashMap<String, String>();

props.put("customEndpoint", "bogus endpoint url");
Expand Down