Skip to content

Commit 9b3fe3b

Browse files
authored
Merge pull request hub4j#687 from bitwiseman/task/windows-ci
Shorten file names for Windows
2 parents 14b7bf4 + 5c6c508 commit 9b3fe3b

79 files changed

Lines changed: 125 additions & 47 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion

.github/workflows/maven-build.yml

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,68 @@
1-
name: Java CI Build and Test
1+
name: CI
22

33
on: [push, pull_request]
44

55

66
jobs:
77
build:
8-
9-
runs-on: ${{ matrix.os }}
8+
name: build-only (Java ${{ matrix.java }})
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
java: [ 11 ]
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: ${{ matrix.java }}
19+
- name: Cached .m2
20+
uses: actions/cache@v1
21+
with:
22+
path: ~/.m2/repository
23+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
24+
restore-keys: |
25+
${{ runner.os }}-maven-
26+
- name: Maven Install (skipTests)
27+
run: mvn -B install -DskipTests -D enable-ci --file pom.xml
28+
site:
29+
name: site (Java ${{ matrix.java }})
30+
runs-on: ubuntu-latest
1031
strategy:
1132
matrix:
12-
os: [windows-latest, ubuntu-latest]
13-
java: [ '1.8.0', '11.0.x', '13.0.x' ]
33+
java: [ 11 ]
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Set up JDK
37+
uses: actions/setup-java@v1
38+
with:
39+
java-version: ${{ matrix.java }}
40+
- uses: actions/cache@v1
41+
with:
42+
path: ~/.m2/repository
43+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
44+
restore-keys: |
45+
${{ runner.os }}-maven-
46+
- name: Maven Site
47+
run: mvn -B site -D enable-ci --file pom.xml
48+
test:
49+
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
50+
runs-on: ${{ matrix.os }}-latest
51+
strategy:
52+
matrix:
53+
os: [ ubuntu, windows ]
54+
java: [ 8, 11, 13 ]
1455
steps:
1556
- uses: actions/checkout@v2
1657
- name: Set up JDK
1758
uses: actions/setup-java@v1
1859
with:
1960
java-version: ${{ matrix.java }}
20-
- name: Maven Download all dependencies
21-
run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline -P ci
22-
- name: Maven Build
23-
run: mvn -B install site -P ci --file pom.xml
61+
- uses: actions/cache@v1
62+
with:
63+
path: ~/.m2/repository
64+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
65+
restore-keys: |
66+
${{ runner.os }}-maven-
67+
- name: Maven Install
68+
run: mvn -B install --file pom.xml

pom.xml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@
203203
<exclude>org.kohsuke.github.GHPerson.1</exclude>
204204
<exclude>org.kohsuke.github.GHPerson.1.1</exclude>
205205

206+
<!-- These fail coverage on windows because tests are disabled -->
207+
<exclude>org.kohsuke.github.GHAsset</exclude>
208+
<exclude>org.kohsuke.github.GHReleaseBuilder</exclude>
209+
<exclude>org.kohsuke.github.GHRelease</exclude>
210+
206211
<!-- TODO: These still need test coverage -->
207212
<exclude>org.kohsuke.github.GitHub.GHApiInfo</exclude>
208213
<exclude>org.kohsuke.github.GHBranchProtection.RequiredSignatures</exclude>
@@ -580,15 +585,28 @@
580585
</pluginRepositories>
581586
<profiles>
582587
<profile>
583-
<id>ci</id>
588+
<id>ci-non-windows</id>
584589
<activation>
585590
<property>
586591
<name>enable-ci</name>
587592
</property>
593+
<os>
594+
<family>!windows</family>
595+
</os>
588596
</activation>
589597
<properties>
590598
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
591599
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
600+
</properties>
601+
</profile>
602+
<profile>
603+
<id>ci-all</id>
604+
<activation>
605+
<property>
606+
<name>enable-ci</name>
607+
</property>
608+
</activation>
609+
<properties>
592610
<jacoco.haltOnFailure>true</jacoco.haltOnFailure>
593611
</properties>
594612
<build>

src/main/java/org/kohsuke/github/Requester.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,9 @@ private boolean retryConnectionError(IOException e, int retries) throws IOExcept
549549
|| e instanceof SSLHandshakeException;
550550
if (connectionError && retries > 0) {
551551
LOGGER.log(INFO,
552-
"Error while connecting to " + uc.getURL() + ". Sleeping " + Requester.retryTimeoutMillis
553-
+ " milliseconds before retrying... ; will try " + retries + " more time(s)",
554-
e);
552+
e.getMessage() + " while connecting to " + uc.getURL() + ". Sleeping "
553+
+ Requester.retryTimeoutMillis + " milliseconds before retrying... ; will try " + retries
554+
+ " more time(s)");
555555
try {
556556
Thread.sleep(Requester.retryTimeoutMillis);
557557
} catch (InterruptedException ie) {

src/test/java/org/kohsuke/github/AppTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.google.common.base.Predicate;
44
import com.google.common.collect.Iterables;
55
import org.apache.commons.io.IOUtils;
6+
import org.apache.commons.lang3.SystemUtils;
7+
import org.junit.Assume;
68
import org.junit.Ignore;
79
import org.junit.Test;
810
import org.kohsuke.github.GHCommit.File;
@@ -896,6 +898,8 @@ public void listOrgMemberships() throws Exception {
896898

897899
@Test
898900
public void blob() throws Exception {
901+
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
902+
899903
GHRepository r = gitHub.getRepository("github-api/github-api");
900904
String sha1 = "a12243f2fc5b8c2ba47dd677d0b0c7583539584d";
901905

src/test/java/org/kohsuke/github/LifecycleTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.kohsuke.github;
22

3+
import org.apache.commons.lang3.SystemUtils;
4+
import org.junit.Assume;
35
import org.junit.Test;
46

57
import java.io.File;
@@ -14,6 +16,8 @@
1416
public class LifecycleTest extends AbstractGitHubWireMockTest {
1517
@Test
1618
public void testCreateRepository() throws IOException {
19+
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
20+
1721
GHMyself myself = gitHub.getMyself();
1822
// GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
1923

src/test/java/org/kohsuke/github/RequesterRetryTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import java.security.Permission;
2121
import java.util.List;
2222
import java.util.Map;
23-
import java.util.logging.Handler;
2423
import java.util.logging.Logger;
24+
import java.util.logging.SimpleFormatter;
2525
import java.util.logging.StreamHandler;
2626

2727
import javax.net.ssl.SSLHandshakeException;
@@ -55,8 +55,7 @@ private GHRepository getRepository(GitHub gitHub) throws IOException {
5555
@Before
5656
public void attachLogCapturer() {
5757
logCapturingStream = new ByteArrayOutputStream();
58-
Handler[] handlers = log.getParent().getHandlers();
59-
customLogHandler = new StreamHandler(logCapturingStream, handlers[0].getFormatter());
58+
customLogHandler = new StreamHandler(logCapturingStream, new SimpleFormatter());
6059
log.addHandler(customLogHandler);
6160
}
6261

src/test/java/org/kohsuke/github/extras/GitHubCachingTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import com.squareup.okhttp.OkHttpClient;
77
import com.squareup.okhttp.OkUrlFactory;
88
import org.apache.commons.io.FileUtils;
9+
import org.apache.commons.lang3.SystemUtils;
10+
import org.junit.Assume;
911
import org.junit.Before;
1012
import org.junit.Test;
1113
import org.kohsuke.github.AbstractGitHubWireMockTest;
@@ -53,7 +55,9 @@ public void setupRepo() throws Exception {
5355
}
5456

5557
@Test
56-
public void OkHttpConnector_Cache_MaxAgeDefault_Zero_GitHubRef_Error() throws Exception {
58+
public void testCached404() throws Exception {
59+
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
60+
5761
// ISSUE #669
5862
snapshotNotAllowed();
5963

src/test/java/org/kohsuke/github/extras/okhttp3/GitHubCachingTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import okhttp3.Cache;
66
import okhttp3.OkHttpClient;
77
import org.apache.commons.io.FileUtils;
8+
import org.apache.commons.lang3.SystemUtils;
9+
import org.junit.Assume;
810
import org.junit.Before;
911
import org.junit.Test;
1012
import org.kohsuke.github.AbstractGitHubWireMockTest;
@@ -54,7 +56,9 @@ public void setupRepo() throws Exception {
5456
}
5557

5658
@Test
57-
public void OkHttpConnector_Cache_MaxAgeDefault_Zero_GitHubRef_Error() throws Exception {
59+
public void testCached404() throws Exception {
60+
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
61+
5862
// ISSUE #669
5963
snapshotNotAllowed();
6064

src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoCRUD/__files/repos_bitwiseman_github-api-test-rename-39714670-728d-4f72-bf18-7b2e6f0ac276.json renamed to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoCRUD/__files/repos_bitwiseman_github-api-test-rename-39714670.json

File renamed without changes.

0 commit comments

Comments
 (0)