-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into issue_381_branch_url_escaping
- Loading branch information
Showing
397 changed files
with
43,932 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Java CI Build and Test | ||
|
||
on: [push, pull_request] | ||
|
||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Maven Download all dependencies | ||
run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline | ||
- name: Maven Build | ||
run: mvn -B package --file pom.xml -Dtest=CommitTest,GistTest,PullRequestTest,UserTest,WireMockStatusReporterTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Contributing | ||
|
||
## Using WireMock and Snapshots | ||
|
||
This project has started converting to using WireMock to stub out http responses instead of use live data. | ||
This change will allow tests to run in a CI environment without needing to touch github.com. | ||
The tests will instead serve previously recorded responses from local data files. | ||
|
||
### Running WireMock tests | ||
|
||
Example: | ||
|
||
`mvn install -Dtest=WireMockStatusReporterTest` | ||
|
||
This the default behavior. | ||
|
||
|
||
### Setting up credential | ||
|
||
1. Create an OAuth token on github.com | ||
2. Set the GITHUB_OAUTH environment variable to the value of that token | ||
3. Set the system property `test.github.useProxy` (usually like "-Dtest.github.useProxy" as a Java VM option) | ||
|
||
`mvn install -Dtest.github.useProxy -Dtest=WireMockStatusReporterTest` | ||
|
||
4. The above should report no test failures and include the following console output: | ||
|
||
`WireMockStatusReporterTest: GitHub proxying and user auth correctly configured for user login: <your login>` | ||
|
||
Whenever you run tests with `-Dtest.github.useProxy`, they will try to get data from local files but will fallback to proxying to github if not found. | ||
|
||
|
||
### Writing a new test | ||
|
||
Once you have credentials setup, you add new test classes and test methods as you would normally. | ||
Keep `useProxy` enabled and iterate on your tests as needed. Remember, while proxying your tests are interacting with GitHub - you will need to clean up your state between runs. | ||
|
||
When you are ready to create a snapshot of your test data, | ||
run your test with `test.github.takeSnapshot` ("-Dtest.github.takeSnapshot" as a Java VM option). For example: | ||
|
||
`mvn install -Dtest.github.takeSnapshot -Dtest=YourTestClassName` | ||
|
||
The above command would create snapshot WireMock data files under the path `src/test/resources/org/kohsuhke/github/YourTestClassName/wiremock`. | ||
Each method would get a separate director that would hold the data files for that test method. | ||
|
||
Add all files including the generated data to your commit and submit a PR. | ||
|
||
### Modifying existing tests | ||
|
||
When modifying existing tests, you can change the stubbed WireMock data files by hand or you can try generating a new snapshot. | ||
|
||
#### Manual editing of data (minor changes only) | ||
|
||
If you know what data will change, it is sometimes simplest to make any required changes to the data files manually. | ||
This can be easier if the changes are minor or when you development environment is not setup to to take updated snapshots. | ||
|
||
#### Generating a new snapshot | ||
|
||
For more most changes, it is recommended to take a new snapshot when updating tests. | ||
Delete the wiremock data files for the test method you will be modifying. | ||
For more significant changes, you can even delete the WireMock files for an entire test class. | ||
Then follow the same as when writing a new test: run with proxy enabled to debug, take a new snapshot when done, commit everything, and submit the PR. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Java API for GitHub | ||
|
||
See https://github-api.kohsuke.org/ for more details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,19 +3,20 @@ | |
<parent> | ||
<groupId>org.kohsuke</groupId> | ||
<artifactId>pom</artifactId> | ||
<version>20</version> | ||
<version>21</version> | ||
<relativePath /> | ||
</parent> | ||
|
||
<artifactId>github-api</artifactId> | ||
<version>1.96-SNAPSHOT</version> | ||
<name>GitHub API for Java</name> | ||
<url>http://github-api.kohsuke.org/</url> | ||
<url>https://github-api.kohsuke.org/</url> | ||
<description>GitHub API for Java</description> | ||
|
||
<scm> | ||
<connection>scm:git:[email protected]/kohsuke/${project.artifactId}.git</connection> | ||
<developerConnection>scm:git:ssh://[email protected]/kohsuke/${project.artifactId}.git</developerConnection> | ||
<url>http://${project.artifactId}.kohsuke.org/</url> | ||
<url>https://${project.artifactId}.kohsuke.org/</url> | ||
<tag>HEAD</tag> | ||
</scm> | ||
|
||
|
@@ -28,12 +29,23 @@ | |
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<findbugs-maven-plugin.version>3.0.2</findbugs-maven-plugin.version> | ||
<findbugs-maven-plugin.failOnError>true</findbugs-maven-plugin.failOnError> | ||
<spotbugs-maven-plugin.version>3.1.11</spotbugs-maven-plugin.version> | ||
<spotbugs.version>3.1.12</spotbugs.version> | ||
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError> | ||
<hamcrest.version>2.1</hamcrest.version> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>7</source> | ||
<target>7</target> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.1</version> | ||
|
@@ -75,22 +87,41 @@ | |
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>findbugs-maven-plugin</artifactId> | ||
<version>${findbugs-maven-plugin.version}</version> | ||
<groupId>com.github.spotbugs</groupId> | ||
<artifactId>spotbugs-maven-plugin</artifactId> | ||
<version>${spotbugs-maven-plugin.version}</version> | ||
<configuration> | ||
<xmlOutput>true</xmlOutput> | ||
<failOnError>${findbugs-maven-plugin.failOnError}</failOnError> | ||
<failOnError>${spotbugs-maven-plugin.failOnError}</failOnError> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>run-findbugs</id> | ||
<id>run-spotbugs</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<dependencies> | ||
<!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs --> | ||
<dependency> | ||
<groupId>com.github.spotbugs</groupId> | ||
<artifactId>spotbugs</artifactId> | ||
<version>${spotbugs.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
<!-- Do not use gmaven plugin --> | ||
<plugin> | ||
<groupId>org.codehaus.gmaven</groupId> | ||
<artifactId>gmaven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
@@ -106,22 +137,35 @@ | |
<artifactId>commons-codec</artifactId> | ||
<version>1.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest</artifactId> | ||
<version>${hamcrest.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- This is needed in order to force junit4 and JTH tests to use newer hamcrest version --> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-core</artifactId> | ||
<version>${hamcrest.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-library</artifactId> | ||
<version>${hamcrest.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-all</artifactId> | ||
<version>1.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.9.2</version> | ||
<version>2.9.9.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
|
@@ -171,22 +215,28 @@ | |
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.code.findbugs</groupId> | ||
<artifactId>annotations</artifactId> | ||
<version>3.0.1</version> | ||
<scope>provided</scope> | ||
<groupId>com.github.spotbugs</groupId> | ||
<artifactId>spotbugs-annotations</artifactId> | ||
<version>${spotbugs.version}</version> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.tomakehurst</groupId> | ||
<artifactId>wiremock-jre8-standalone</artifactId> | ||
<version>2.24.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<repositories> | ||
<repository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
<url>https://repo.jenkins-ci.org/public/</url> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
<url>https://repo.jenkins-ci.org/public/</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
|
@@ -202,7 +252,7 @@ | |
<licenses> | ||
<license> | ||
<name>The MIT license</name> | ||
<url>http://www.opensource.org/licenses/mit-license.php</url> | ||
<url>https://www.opensource.org/licenses/mit-license.php</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.