Skip to content

Commit

Permalink
Validate formatting has been done before CI (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet authored Jul 26, 2024
1 parent 9dcb788 commit c258502
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
maven-version: '3.9.8'

- name: Build with maven
run: mvn -B --errors --activate-profiles ci --no-transfer-progress package -DskipTests
run: mvn -B --errors --activate-profiles ci,format-check --no-transfer-progress package -DskipTests

test:
needs: compile
Expand Down
16 changes: 14 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
<surefireJdk>[${minimalJavaBuildVersion},)</surefireJdk>
<minimalMavenBuildVersion>3.9.8</minimalMavenBuildVersion>

<format.impsort.action>sort</format.impsort.action>
<format.formatter.action>format</format.formatter.action>


<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputTimestamp>2024-07-23T13:00:38Z</project.build.outputTimestamp>

Expand Down Expand Up @@ -133,6 +137,14 @@
</properties>

<profiles>
<profile>
<id>format-check</id>
<properties>
<format.impsort.action>check</format.impsort.action>
<format.formatter.action>validate</format.formatter.action>
</properties>
</profile>

<profile>
<id>toolchains</id>
<activation>
Expand Down Expand Up @@ -1029,7 +1041,7 @@
<id>format</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
<goal>${format.formatter.action}</goal>
</goals>
</execution>
</executions>
Expand All @@ -1042,7 +1054,7 @@
<id>sort-imports</id>
<phase>process-sources</phase>
<goals>
<goal>sort</goal>
<goal>${format.impsort.action}</goal>
</goals>
</execution>
</executions>
Expand Down

0 comments on commit c258502

Please sign in to comment.