Skip to content

Commit 70bfcee

Browse files
authored
Merge pull request #20 from spt-development/feature/quality-improvements
Added additional quality gates to build.
2 parents 9f59c4b + 3552ea3 commit 70bfcee

31 files changed

+1395
-533
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,28 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
persist-credentials: false
1114

1215
- name: Set up JDK 21
1316
uses: oracle-actions/setup-java@v1
1417
with:
1518
website: jdk.java.net
1619
release: 21
17-
18-
- name: Build with Maven
19-
run: mvn clean install -B
20-
21-
- name: Mutation testing
22-
run: mvn org.pitest:pitest-maven:mutationCoverage -B
20+
- run: ./mvnw clean install -Pall-quality-gates -B
2321

2422
release:
2523
runs-on: ubuntu-latest
2624
needs: build
2725
if: github.ref == 'refs/heads/main'
2826

2927
steps:
30-
- uses: actions/checkout@v3
28+
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
persist-credentials: false
3132

3233
- name: Set up JDK 21
3334
uses: oracle-actions/setup-java@v1
@@ -36,7 +37,7 @@ jobs:
3637
release: 21
3738

3839
- name: Determine version
39-
run: echo "POM_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec | sed -e 's/-SNAPSHOT//')" >> $GITHUB_ENV
40+
run: echo "POM_VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec | sed -e 's/-SNAPSHOT//')" >> $GITHUB_ENV
4041

4142
- name: Import GPG key
4243
id: import_gpg
@@ -51,7 +52,7 @@ jobs:
5152
git config user.name "GitHub Actions"
5253
5354
- name: Create release
54-
run: mvn --settings .github/maven-settings.xml release:prepare release:perform -DskipTests -Prelease -B
55+
run: ./mvnw --settings .github/maven-settings.xml release:prepare release:perform -DskipTests -Prelease -B
5556
env:
5657
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
5758
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
@@ -66,4 +67,5 @@ jobs:
6667
token: ${{ secrets.GITHUB_TOKEN }}
6768
tag: ${{ env.POM_VERSION }}
6869
artifacts: target/spt-development-logging-spring-${{ env.POM_VERSION }}.jar
69-
artifactContentType: application/java-archive
70+
artifactContentType: application/java-archive
71+
bodyFile: documentation/releases/release-${{ env.POM_VERSION }}.md
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Latest Versions Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
versions:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Set up JDK 21
13+
uses: oracle-actions/setup-java@v1
14+
with:
15+
website: jdk.java.net
16+
release: 21
17+
- run: ./mvnw clean versions:update-properties scm:check-local-modification -U -B

.github/workflows/owasp.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: OWASP Dependency Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
owasp:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Set up JDK 21
13+
uses: oracle-actions/setup-java@v1
14+
with:
15+
website: jdk.java.net
16+
release: 21
17+
- run: ./mvnw clean dependency-check:check -B
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Building locally
4848
To build the library, run the following maven command:
4949

5050
```shell
51-
$ mvn clean install
51+
$ ./mvnw clean install
5252
```
5353

5454
Release
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE suppressions PUBLIC
3+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
4+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
5+
<suppressions>
6+
<!-- Fully Suppressed Rules (all projects) -->
7+
<suppress checks="CustomImportOrder" files="." />
8+
<suppress checks="OverloadMethodsDeclarationOrder" files="." />
9+
10+
<!-- Fully Suppressed Rules (non-library projects only) -->
11+
<suppress checks="MissingJavadocType" files="." />
12+
<suppress checks="MissingJavadocMethod" files="." />
13+
14+
<!-- Rules Replaced by spt_checks.xml -->
15+
<suppress checks="Indentation" files="." />
16+
<suppress checks="LineLength" files="." />
17+
</suppressions>

config/checkstyle/spt_checks.xml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
Used in conjunction with google_checks_suppressions.xml to override
8+
https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
9+
default rules. See
10+
https://stackoverflow.com/questions/63953276/maven-checkstyle-plugin-with-google-checks-and-4-space-indentsize
11+
for more info.
12+
13+
Also adds in additional rules, such as CyclomaticComplexity checks.
14+
-->
15+
<module name = "Checker">
16+
<!-- Overrides -->
17+
<module name="LineLength">
18+
<property name="fileExtensions" value="java"/>
19+
<property name="max" value="150"/>
20+
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://|@ApiModelProperty| class .*"/>
21+
</module>
22+
23+
<module name="TreeWalker">
24+
<!-- Overrides -->
25+
<module name="Indentation">
26+
<property name="basicOffset" value="4"/>
27+
<property name="braceAdjustment" value="0"/>
28+
<property name="caseIndent" value="4"/>
29+
<property name="throwsIndent" value="4"/>
30+
<property name="lineWrappingIndentation" value="4"/>
31+
<property name="arrayInitIndent" value="8"/>
32+
</module>
33+
34+
<!-- SPT Specific rules -->
35+
36+
<!-- SPT Custom -->
37+
<module name="MatchXpath">
38+
<property name="query" value="//VARIABLE_DEF/TYPE/IDENT[@text='var']"/>
39+
<message key="matchxpath.match" value="The `var` keyword should be avoided to keep the code easier to understand"/>
40+
</module>
41+
42+
<!-- Coding: https://checkstyle.sourceforge.io/checks/coding/index.html -->
43+
<module name="DeclarationOrder" />
44+
<module name="FinalLocalVariable" />
45+
<module name="IllegalThrows" />
46+
<module name="MagicNumber" />
47+
<module name="NestedForDepth" />
48+
<module name="NestedIfDepth" />
49+
<module name="NestedTryDepth" />
50+
<module name="ParameterAssignment" />
51+
52+
<!-- Imports: https://checkstyle.sourceforge.io/checks/imports/index.html -->
53+
<module name="IllegalImport" />
54+
<module name="RedundantImport" />
55+
<module name="UnusedImports" />
56+
57+
<!-- Miscellaneous: https://checkstyle.sourceforge.io/checks/misc/todocomment.html -->
58+
<module name="TodoComment">
59+
<property name="format" value="(TODO)|(FIXME)" />
60+
</module>
61+
62+
<!-- Modifiers: https://checkstyle.sourceforge.io/checks/modifier/index.html -->
63+
<module name="RedundantModifier" />
64+
65+
<!-- Naming Conventions: https://checkstyle.sourceforge.io/checks/naming/index.html -->
66+
<module name="CatchParameterName" />
67+
<module name="ConstantName" />
68+
69+
<!-- Size violations: https://checkstyle.sourceforge.io/checks/sizes/index.html -->
70+
<module name="ParameterNumber">
71+
<property name="max" value="10"/>
72+
<property name="tokens" value="CTOR_DEF"/>
73+
</module>
74+
<module name="ParameterNumber">
75+
<property name="max" value="5"/>
76+
<property name="tokens" value="METHOD_DEF"/>
77+
</module>
78+
</module>
79+
</module>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE suppressions PUBLIC
3+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
4+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
5+
<suppressions>
6+
<!-- Allow Logger aspect methods to throw Throwable -->
7+
<suppress checks="IllegalThrows" files="src[\\/]main[\\/]java[\\/]com[\\/]spt[\\/]development[\\/]logging[\\/]spring[\\/]LoggerAspect.java" />
8+
<suppress checks="IllegalThrows" files="src[\\/]main[\\/]java[\\/]com[\\/]spt[\\/]development[\\/]logging[\\/]spring[\\/](JmsListener|RestController|Repository|Service)Logger.java" />
9+
</suppressions>
File renamed without changes.

config/owasp/suppress.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
3+
</suppressions>

0 commit comments

Comments
 (0)