Skip to content

Commit 55bbd1c

Browse files
authored
Add simple CI and rename packages (#3)
Signed-off-by: Jakub Stejskal <xstejs24@gmail.com>
1 parent a75e038 commit 55bbd1c

File tree

7 files changed

+398
-184
lines changed

7 files changed

+398
-184
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest]
15+
java: [11, 17, 21]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up JDK ${{ matrix.java }}
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: ${{ matrix.java }}
25+
distribution: 'temurin'
26+
27+
- name: Cache Maven dependencies
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.m2
31+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32+
restore-keys: ${{ runner.os }}-m2
33+
34+
- name: Build with Maven
35+
run: mvn clean compile -B
36+
37+
- name: Package
38+
run: mvn package -B
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0"?>
2+
3+
<!DOCTYPE suppressions PUBLIC
4+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
5+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
6+
7+
<!--
8+
Licensed to the Apache Software Foundation (ASF) under one
9+
or more contributor license agreements. See the NOTICE file
10+
distributed with this work for additional information
11+
regarding copyright ownership. The ASF licenses this file
12+
to you under the Apache License, Version 2.0 (the
13+
"License"); you may not use this file except in compliance
14+
with the License. You may obtain a copy of the License at
15+
16+
http://www.apache.org/licenses/LICENSE-2.0
17+
18+
Unless required by applicable law or agreed to in writing,
19+
software distributed under the License is distributed on an
20+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21+
KIND, either express or implied. See the License for the
22+
specific language governing permissions and limitations
23+
under the License.
24+
-->
25+
26+
<suppressions>
27+
<!-- Suppress design checks for Maven plugin classes -->
28+
<suppress checks="DesignForExtension" files=".*Mojo\.java"/>
29+
<suppress checks="HideUtilityClassConstructor" files=".*Mojo\.java"/>
30+
31+
<!-- Allow magic numbers in Maven plugin parameter defaults -->
32+
<suppress checks="MagicNumber" files=".*Mojo\.java"/>
33+
34+
<!-- Allow hidden fields for Maven plugin parameters -->
35+
<suppress checks="HiddenField" files=".*Mojo\.java"/>
36+
37+
<!-- Allow protected/public fields for Maven plugin parameters -->
38+
<suppress checks="VisibilityModifier" files=".*Mojo\.java"/>
39+
</suppressions>

checkstyle/checkstyle.xml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
6+
<!--
7+
Licensed to the Apache Software Foundation (ASF) under one
8+
or more contributor license agreements. See the NOTICE file
9+
distributed with this work for additional information
10+
regarding copyright ownership. The ASF licenses this file
11+
to you under the Apache License, Version 2.0 (the
12+
"License"); you may not use this file except in compliance
13+
with the License. You may obtain a copy of the License at
14+
15+
http://www.apache.org/licenses/LICENSE-2.0
16+
17+
Unless required by applicable law or agreed to in writing,
18+
software distributed under the License is distributed on an
19+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20+
KIND, either express or implied. See the License for the
21+
specific language governing permissions and limitations
22+
under the License.
23+
-->
24+
25+
<module name="Checker">
26+
<property name="charset" value="UTF-8"/>
27+
<property name="severity" value="warning"/>
28+
<property name="fileExtensions" value="java, properties, xml"/>
29+
30+
<!-- Excludes all 'module-info.java' files -->
31+
<!-- See https://checkstyle.org/config_filefilters.html -->
32+
<module name="BeforeExecutionExclusionFileFilter">
33+
<property name="fileNamePattern" value="module\-info\.java$"/>
34+
</module>
35+
36+
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
37+
<module name="SuppressionFilter">
38+
<property name="file" value="${org.checkstyle.sun.suppressionfilter.config}"
39+
default="checkstyle-suppressions.xml" />
40+
<property name="optional" value="true"/>
41+
</module>
42+
43+
<!-- Checks for whitespace -->
44+
<!-- See http://checkstyle.org/config_whitespace.html -->
45+
<module name="FileTabCharacter">
46+
<property name="eachLine" value="true"/>
47+
</module>
48+
49+
<module name="LineLength">
50+
<property name="fileExtensions" value="java"/>
51+
<property name="max" value="140"/>
52+
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
53+
</module>
54+
55+
<module name="TreeWalker">
56+
<!-- Checks for Naming Conventions. -->
57+
<!-- See http://checkstyle.org/config_naming.html -->
58+
<module name="ConstantName"/>
59+
<module name="LocalFinalVariableName"/>
60+
<module name="LocalVariableName"/>
61+
<module name="MemberName"/>
62+
<module name="MethodName"/>
63+
<module name="PackageName"/>
64+
<module name="ParameterName"/>
65+
<module name="StaticVariableName"/>
66+
<module name="TypeName"/>
67+
68+
<!-- Checks for imports -->
69+
<!-- See http://checkstyle.org/config_import.html -->
70+
<module name="AvoidStarImport"/>
71+
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
72+
<module name="RedundantImport"/>
73+
<module name="UnusedImports">
74+
<property name="processJavadoc" value="false"/>
75+
</module>
76+
77+
<!-- Checks for Size Violations. -->
78+
<!-- See http://checkstyle.org/config_sizes.html -->
79+
<module name="MethodLength"/>
80+
<module name="ParameterNumber"/>
81+
82+
<!-- Checks for whitespace -->
83+
<!-- See http://checkstyle.org/config_whitespace.html -->
84+
<module name="EmptyForIteratorPad"/>
85+
<module name="GenericWhitespace"/>
86+
<module name="MethodParamPad"/>
87+
<module name="NoWhitespaceAfter"/>
88+
<module name="NoWhitespaceBefore"/>
89+
<module name="OperatorWrap"/>
90+
<module name="ParenPad"/>
91+
<module name="TypecastParenPad"/>
92+
<module name="WhitespaceAfter"/>
93+
<module name="WhitespaceAround"/>
94+
95+
<!-- Modifier Checks -->
96+
<!-- See http://checkstyle.org/config_modifiers.html -->
97+
<module name="ModifierOrder"/>
98+
<module name="RedundantModifier"/>
99+
100+
<!-- Checks for blocks. You know, those {}'s -->
101+
<!-- See http://checkstyle.org/config_blocks.html -->
102+
<module name="AvoidNestedBlocks"/>
103+
<module name="EmptyBlock"/>
104+
<module name="LeftCurly"/>
105+
<module name="NeedBraces"/>
106+
<module name="RightCurly"/>
107+
108+
<!-- Checks for common coding problems -->
109+
<!-- See http://checkstyle.org/config_coding.html -->
110+
<module name="EmptyStatement"/>
111+
<module name="EqualsHashCode"/>
112+
<module name="HiddenField"/>
113+
<module name="IllegalInstantiation"/>
114+
<module name="InnerAssignment"/>
115+
<module name="MagicNumber"/>
116+
<module name="MissingSwitchDefault"/>
117+
<module name="MultipleVariableDeclarations"/>
118+
<module name="SimplifyBooleanExpression"/>
119+
<module name="SimplifyBooleanReturn"/>
120+
121+
<!-- Checks for class design -->
122+
<!-- See http://checkstyle.org/config_design.html -->
123+
<module name="DesignForExtension"/>
124+
<module name="FinalClass"/>
125+
<module name="HideUtilityClassConstructor"/>
126+
<module name="InterfaceIsType"/>
127+
<module name="VisibilityModifier"/>
128+
129+
<!-- Miscellaneous other checks. -->
130+
<!-- See http://checkstyle.org/config_misc.html -->
131+
<module name="ArrayTypeStyle"/>
132+
<module name="FinalParameters"/>
133+
<module name="TodoComment"/>
134+
<module name="UpperEll"/>
135+
136+
<module name="Indentation">
137+
<property name="basicOffset" value="4"/>
138+
<property name="braceAdjustment" value="0"/>
139+
<property name="caseIndent" value="4"/>
140+
<property name="throwsIndent" value="4"/>
141+
<property name="lineWrappingIndentation" value="4"/>
142+
<property name="arrayInitIndent" value="4"/>
143+
</module>
144+
</module>
145+
</module>

pom.xml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ under the License.
5858
<maven-dependency-tree.version>3.3.0</maven-dependency-tree.version>
5959
<maven-plugin-annotations.version>3.5.2</maven-plugin-annotations.version>
6060
<maven-common-artifact-filters.version>3.0.1</maven-common-artifact-filters.version>
61+
<maven-checkstyle.version>3.5.0</maven-checkstyle.version>
62+
<checkstyle.version>10.18.0</checkstyle.version>
63+
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
64+
<maven-plugin-plugin.version>3.15.1</maven-plugin-plugin.version>
6165
</properties>
6266

6367
<dependencyManagement>
@@ -122,17 +126,46 @@ under the License.
122126
<skip>false</skip>
123127
</configuration>
124128
</plugin>
129+
<plugin>
130+
<groupId>org.apache.maven.plugins</groupId>
131+
<artifactId>maven-checkstyle-plugin</artifactId>
132+
<version>${maven-checkstyle.version}</version>
133+
<dependencies>
134+
<dependency>
135+
<groupId>com.puppycrawl.tools</groupId>
136+
<artifactId>checkstyle</artifactId>
137+
<version>${checkstyle.version}</version>
138+
</dependency>
139+
</dependencies>
140+
<configuration>
141+
<configLocation>checkstyle/checkstyle.xml</configLocation>
142+
<suppressionsLocation>checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
143+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
144+
<failOnViolation>true</failOnViolation>
145+
<violationSeverity>warning</violationSeverity>
146+
<consoleOutput>true</consoleOutput>
147+
</configuration>
148+
<executions>
149+
<execution>
150+
<id>checkstyle</id>
151+
<phase>validate</phase>
152+
<goals>
153+
<goal>check</goal>
154+
</goals>
155+
</execution>
156+
</executions>
157+
</plugin>
125158
</plugins>
126159
<pluginManagement>
127160
<plugins>
128161
<plugin>
129162
<groupId>org.apache.maven.plugins</groupId>
130163
<artifactId>maven-compiler-plugin</artifactId>
131-
<version>3.14.0</version>
164+
<version>${maven-compiler-plugin.version}</version>
132165
</plugin>
133166
<plugin>
134167
<artifactId>maven-plugin-plugin</artifactId>
135-
<version>3.15.1</version>
168+
<version>${maven-plugin-plugin.version}</version>
136169
<configuration>
137170
<goalPrefix>alignment-reporter</goalPrefix>
138171
</configuration>

0 commit comments

Comments
 (0)