Skip to content

Commit

Permalink
Add github actions to check Java Import are sorted.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Jul 13, 2022
1 parent c82280c commit 6611454
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/actions/sortimport/action.yml
@@ -0,0 +1,40 @@
name: "Check Java Import"
description: "Check Java Import are well sorted with Maven"

runs:
using: "composite"
steps:

- name: Check Java Import
id: sort_import
shell: bash
run: mvn -B impsort:check

- name: Add comment
if: failure()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Java Import check Failed
message: |
:x: **Java Import are not sorted !** [(more details)](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
Ensure your code build locally using:
```
mvn clean install
```
Or just validate java import with :
```
mvn impsort:check
```
You can sort Java import with :
```
mvn impsort:sort
```
See also [How configure your IDE](https://github.com/eclipse/leshan/wiki/Code-&-design-guidelines#configure-your-ide).
- name: Delete comment
if: success()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Java Import check Failed
delete: true
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -40,11 +40,17 @@ jobs:
id: build
uses: ./.github/actions/build

- name: Java Import Check
if: always()
id: sortimport
uses: ./.github/actions/sortimport

- name: Code Style Check
if: always()
id: checkstyle
uses: ./.github/actions/checkstyle


- name: Check Android API Compliance
if: ${{ always() && steps.build.conclusion == 'success' }}
uses: ./.github/actions/android-check
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -133,6 +133,7 @@ Contributors:
<revapi.skip>true</revapi.skip>
<formatter.skip>true</formatter.skip>
<checkstyle.skip>true</checkstyle.skip>
<impsort.skip>true</impsort.skip>
</properties>
</profile>
</profiles>
Expand Down

0 comments on commit 6611454

Please sign in to comment.