Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten file names for Windows #687

Merged
merged 9 commits into from
Jan 30, 2020
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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ We love getting PRs, but we hate asking people for the same basic changes every
- [ ] Push your changes to a branch other than `master`. Create your PR from that branch.
- [ ] Add JavaDocs and other comments
- [ ] Write tests that run and pass in CI. See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to capture snapshot data.
- [ ] Run `mvn -P ci install site` locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.
- [ ] Run `mvn -D enable-ci install site` locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.
63 changes: 54 additions & 9 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,68 @@
name: Java CI Build and Test
name: CI

on: [push, pull_request]


jobs:
build:

runs-on: ${{ matrix.os }}
name: build-only (Java ${{ matrix.java }})
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Cached .m2
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Maven Install (skipTests)
run: mvn -B install -DskipTests -D enable-ci --file pom.xml
site:
name: site (Java ${{ matrix.java }})
runs-on: ubuntu-latest
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
java: [ '1.8.0', '11.0.x', '13.0.x' ]
java: [ 11 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Maven Site
run: mvn -B site -D enable-ci --file pom.xml
test:
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ ubuntu, windows ]
java: [ 8, 11, 13 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Maven Download all dependencies
run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline -P ci
- name: Maven Build
run: mvn -B install site -P ci --file pom.xml
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Maven Install
run: mvn -B install --file pom.xml
20 changes: 19 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@
<exclude>org.kohsuke.github.GHPerson.1</exclude>
<exclude>org.kohsuke.github.GHPerson.1.1</exclude>

<!-- These fail coverage on windows because tests are disabled -->
<exclude>org.kohsuke.github.GHAsset</exclude>
<exclude>org.kohsuke.github.GHReleaseBuilder</exclude>
<exclude>org.kohsuke.github.GHRelease</exclude>

<!-- TODO: These still need test coverage -->
<exclude>org.kohsuke.github.GitHub.GHApiInfo</exclude>
<exclude>org.kohsuke.github.GHBranchProtection.RequiredSignatures</exclude>
Expand Down Expand Up @@ -580,15 +585,28 @@
</pluginRepositories>
<profiles>
<profile>
<id>ci</id>
<id>ci-non-windows</id>
<activation>
<property>
<name>enable-ci</name>
</property>
<os>
<family>!windows</family>
</os>
</activation>
<properties>
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
</properties>
</profile>
<profile>
<id>ci-all</id>
<activation>
<property>
<name>enable-ci</name>
</property>
</activation>
<properties>
<jacoco.haltOnFailure>true</jacoco.haltOnFailure>
</properties>
<build>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/kohsuke/github/Requester.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,9 @@ private boolean retryConnectionError(IOException e, int retries) throws IOExcept
|| e instanceof SSLHandshakeException;
if (connectionError && retries > 0) {
LOGGER.log(INFO,
"Error while connecting to " + uc.getURL() + ". Sleeping " + Requester.retryTimeoutMillis
+ " milliseconds before retrying... ; will try " + retries + " more time(s)",
e);
e.getMessage() + " while connecting to " + uc.getURL() + ". Sleeping "
+ Requester.retryTimeoutMillis + " milliseconds before retrying... ; will try " + retries
+ " more time(s)");
try {
Thread.sleep(Requester.retryTimeoutMillis);
} catch (InterruptedException ie) {
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/org/kohsuke/github/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
import org.kohsuke.github.GHCommit.File;
Expand Down Expand Up @@ -896,6 +898,8 @@ public void listOrgMemberships() throws Exception {

@Test
public void blob() throws Exception {
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);

GHRepository r = gitHub.getRepository("github-api/github-api");
String sha1 = "a12243f2fc5b8c2ba47dd677d0b0c7583539584d";

Expand Down
4 changes: 4 additions & 0 deletions src/test/java/org/kohsuke/github/LifecycleTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.kohsuke.github;

import org.apache.commons.lang3.SystemUtils;
import org.junit.Assume;
import org.junit.Test;

import java.io.File;
Expand All @@ -14,6 +16,8 @@
public class LifecycleTest extends AbstractGitHubWireMockTest {
@Test
public void testCreateRepository() throws IOException {
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);

GHMyself myself = gitHub.getMyself();
// GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);

Expand Down
5 changes: 2 additions & 3 deletions src/test/java/org/kohsuke/github/RequesterRetryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.security.Permission;
import java.util.List;
import java.util.Map;
import java.util.logging.Handler;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.util.logging.StreamHandler;

import javax.net.ssl.SSLHandshakeException;
Expand Down Expand Up @@ -55,8 +55,7 @@ private GHRepository getRepository(GitHub gitHub) throws IOException {
@Before
public void attachLogCapturer() {
logCapturingStream = new ByteArrayOutputStream();
Handler[] handlers = log.getParent().getHandlers();
customLogHandler = new StreamHandler(logCapturingStream, handlers[0].getFormatter());
customLogHandler = new StreamHandler(logCapturingStream, new SimpleFormatter());
log.addHandler(customLogHandler);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.OkUrlFactory;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.kohsuke.github.AbstractGitHubWireMockTest;
Expand Down Expand Up @@ -53,7 +55,9 @@ public void setupRepo() throws Exception {
}

@Test
public void OkHttpConnector_Cache_MaxAgeDefault_Zero_GitHubRef_Error() throws Exception {
public void testCached404() throws Exception {
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);

// ISSUE #669
snapshotNotAllowed();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.kohsuke.github.AbstractGitHubWireMockTest;
Expand Down Expand Up @@ -54,7 +56,9 @@ public void setupRepo() throws Exception {
}

@Test
public void OkHttpConnector_Cache_MaxAgeDefault_Zero_GitHubRef_Error() throws Exception {
public void testCached404() throws Exception {
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);

// ISSUE #669
snapshotNotAllowed();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename-b1b91949-0448-415c-998e-a38135c37661.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename-b1b91949.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:01 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename-39714670-728d-4f72-bf18-7b2e6f0ac276.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename-39714670.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:02 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename-b0c1117a-926e-4ccd-baf3-c7813a465a7a.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename-b0c1117a.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:02 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename-6cc04a40-acd6-409b-b004-671cbc0c03c8.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename-6cc04a40.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:02 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename2-c1bd7f2a-cab0-4208-b4c8-f2a24bca9169.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename2-c1bd7f2a.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:03 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5322,7 +5322,7 @@
"url": "https://api.github.com/repos/github-api/github-api/git/trees/23d4565bd270308657a4e5b65cb6e6bec6736b54"
},
{
"path": "src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetDirectoryContentTrailingSlash/__files",
"path": "src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetDirectoryContentTrailingSlashtestGetDirectoryContentTrailingSlash/__files",
"mode": "040000",
"type": "tree",
"sha": "98db44a404132445a934e7e1b28d0d94a8243a6e",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api_github-api-1c232f75-a19d-455f-b0c5-4278cc80a1e9.json",
"bodyFileName": "repos_github-api_github-api-1c232f75.json",
"headers": {
"Date": "Sat, 26 Oct 2019 01:27:03 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api_github-api_git_trees_master-ffd3e351-e215-4bef-9756-a608a46e6c42.json",
"bodyFileName": "repos_github-api_github-api_git_trees_master-ffd3e351.json",
"headers": {
"Date": "Sat, 26 Oct 2019 01:27:04 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_temp-testenablebranchprotections-02ee4913-4f10-4403-9f86-c911719d8b88.json",
"bodyFileName": "repos_github-api-test-org_temp-02ee4913.json",
"headers": {
"Date": "Tue, 19 Nov 2019 03:01:32 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_temp-testenablebranchprotections_branches_master-040c1d69-d6af-4a94-b583-7d18957bad10.json",
"bodyFileName": "repos_github-api-test-org_temp-040c1d69.json",
"headers": {
"Date": "Tue, 19 Nov 2019 03:01:32 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_temp-testenablebranchprotections_branches_master_protection-aa97cf7b-7c9d-4c01-b7c5-bccc62b30873.json",
"bodyFileName": "repos_github-api-test-org_temp-aa97cf7b.json",
"headers": {
"Date": "Tue, 19 Nov 2019 03:01:32 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_temp-testenablerequirereviewsonly_branches_master_protection-b57fab91-f2a6-4d52-b6d4-05e4a8be5df4.json",
"bodyFileName": "repos_github-api-test-org_temp-testenablerequirereviewsonly_branches_master_protection-b57fab91.json",
"headers": {
"Date": "Tue, 19 Nov 2019 03:01:41 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-e5080341-7377-4f3f-9427-388a105a91a7.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-e5080341.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:44 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50-3cdae02b-77ed-4fb7-96fa-fee8aab5e88d.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50-3cdae02b.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:46 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-a5a649cc-8b2b-4c58-ba06-8445261108f8.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-a5a649cc.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:48 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"response": {
"status": 201,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-a971220e-d7f0-4919-9963-dbcedf5577e7.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-a971220e.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:45 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-5b2d0899-ece6-4a5f-a8dc-4b0f296b21a1.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-5b2d0899.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:46 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-4be43bcb-37e3-4c54-8b0a-c190690dc820.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-4be43bcb.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:46 GMT",
"Content-Type": "application/json; charset=utf-8",
Expand Down
Loading