Skip to content

Commit 8da490d

Browse files
nwithan8Justintime50jchen293
authored
Enforce minimum version (#84)
* - Add GitHub Action to trigger CheckStyle checks on non-master push * - New Bash and Batch script for "dev_tools" (just CheckStyle functions now) - Ignore "dev_tools" directory in .gitignore * - Added Apache Maven CheckStyle plugin (run with `mvn verify`) * Update .github/workflows/checkstyle.yml Co-authored-by: Justin Hammond <[email protected]> * - Remove dev_tools scripts, use Maven plugin instead for CheckStyle * - Remove checkstyle.yml, roll functionality into existing CI Action * - Update name of CheckStyle CI job * - Added Maven Enforcer Plugin to enforce required Java version (via https://maven.apache.org/enforcer/enforcer-rules/requireJavaVersion.html) * - Check Java 8 - 17 in CI Action - Specifically use v0.4.0 of checkstyle-action * - Bump Gson to 2.8.9, junit to 4.13.2 - Use CheckStyle 9.2.1 for Maven CheckStyle check - Maven CheckStyle plugin will fail in Java 6/7 environment; if you want to develop for this library, you'll need to be running Java 8+ * - Explicitly support Java 6 - 17.0.1 - GitHub CI tests compatibility in Java 6 - 17 * add Java version to the User-Agent in requests (#83) * - Tweak Maven Enforcer plugin to support 1.6.0+ (no explicit max) * - Fix Java versions in GitHub CI * - Remove Java 6 support for GitHub CI * - Continue Java compatibility tests even if one fails * Testing continue-on-error * - Skip CheckStyle checks in compatibility check * - Continue compatibility tests even if/when Java 7 fails because of CheckStyle plugin * - Drop testing for Java 7, since it's always going to fail because of CheckStyle (causing other tests to abort early) * - EasyPost explicitly supports Java 8+ * - Ignore TODO comments in CheckStyle - Exclude EasyPost.java in CheckStyle checks - Fail GitHub CI when CheckStyle errors are present * - Enforce TODOs in Java files, ignore in all other types of files Co-authored-by: Justin Hammond <[email protected]> Co-authored-by: jchen293 <[email protected]>
1 parent d14f627 commit 8da490d

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
javaversion: ['8', '9', '10', '11']
13+
javaversion: ['8', '9', '10', '11', '12', '13', '14', '15', '16', '17']
1414
steps:
1515
- uses: actions/checkout@v2
1616
- name: Set up Java ${{ matrix.javaversion }}
1717
uses: actions/setup-java@v1
1818
with:
1919
java-version: ${{ matrix.javaversion }}
2020
- name: Build with Maven
21-
run: mvn --batch-mode install -Dgpg.skip=true -DskipTests=true
21+
run: mvn --batch-mode install -Dgpg.skip=true -DskipTests=true -Dcheckstyle.skip=true
2222
lint:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v2
2626
- name: Run CheckStyle checks
2727
uses: nikitasavinov/[email protected]
2828
with:
29+
level: error
30+
fail_on_error: true
2931
checkstyle_config: easypost_java_style.xml
3032
tool_name: 'style_enforcer'
3133

pom.xml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@
3838
<dependency>
3939
<groupId>com.google.code.gson</groupId>
4040
<artifactId>gson</artifactId>
41-
<version>2.7</version>
41+
<version>2.8.9</version>
4242
</dependency>
4343
<dependency>
4444
<groupId>junit</groupId>
4545
<artifactId>junit</artifactId>
46-
<version>4.13.1</version>
46+
<version>4.13.2</version>
4747
<scope>test</scope>
4848
</dependency>
4949
<dependency>
@@ -166,6 +166,13 @@
166166
<groupId>org.apache.maven.plugins</groupId>
167167
<artifactId>maven-checkstyle-plugin</artifactId>
168168
<version>3.1.2</version>
169+
<dependencies>
170+
<dependency>
171+
<groupId>com.puppycrawl.tools</groupId>
172+
<artifactId>checkstyle</artifactId>
173+
<version>9.2.1</version>
174+
</dependency>
175+
</dependencies>
169176
<executions>
170177
<execution>
171178
<id>validate</id>
@@ -182,6 +189,26 @@
182189
</execution>
183190
</executions>
184191
</plugin>
192+
<plugin>
193+
<groupId>org.apache.maven.plugins</groupId>
194+
<artifactId>maven-enforcer-plugin</artifactId>
195+
<version>3.0.0</version>
196+
<executions>
197+
<execution>
198+
<id>enforce-java</id>
199+
<goals>
200+
<goal>enforce</goal>
201+
</goals>
202+
<configuration>
203+
<rules>
204+
<requireJavaVersion>
205+
<version>[1.8.0,)</version>
206+
</requireJavaVersion>
207+
</rules>
208+
</configuration>
209+
</execution>
210+
</executions>
211+
</plugin>
185212
</plugins>
186213
</build>
187214
</project>

style_suppressions.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@
55
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
66

77
<suppressions>
8+
<!-- TODO: Include Test files -->
89
<!-- Don't do any CheckStyle checks on any Test files. -->
910
<suppress checks="[a-zA-Z0-9]*"
1011
files="com[\\/]easypost[\\/].*Test.java"/>
1112
<!-- Don't do any CheckStyle checks on any com.easypost.app files. -->
1213
<suppress checks="[a-zA-Z0-9]*"
1314
files="com[\\/]easypost[\\/]app[\\/]"/>
15+
<!-- Don't do any CheckStyle checks on com.easypost.EasyPost. -->
16+
<suppress checks="[a-zA-Z0-9]*"
17+
files="EasyPost.java"/>
18+
<!-- Don't do any CheckStyle checks on any non-Java files. -->
19+
<suppress files=".+\.(?:txt|xml|csv|sh|thrift|html|sql|eot|ttf|woff|css|png)$"
20+
checks=".*"/>
1421
</suppressions>

0 commit comments

Comments
 (0)