100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Add Spotless checks to CI/CD
Wouter Bornd6941d97c96a
diff --git a/.github/workflows/check-spotless.yml b/.github/workflows/check-spotless.ymlnew file mode 100644index 000000000..e9b3dc856--- /dev/null+++ b/.github/workflows/check-spotless.yml@@ -0,0 +1,25 @@+name: Backend Check Spotless+on:+ workflow_call:+ inputs:+ skip:+ type: boolean+ description: Skip condition to allow branch protection checks to pass+ default: false++jobs:+ backend-check-spotless:+ name: Backend Check Spotless+ if: ${{ !inputs.skip }}+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ - name: Set up JDK 21 and gradle cache+ uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0+ with:+ distribution: "temurin"+ java-version: "21"+ cache: "gradle"+ - name: Check Spotless+ timeout-minutes: 20+ run: ./gradlew spotlessBackendCheckdiff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex 97417194c..28f3c4fcb 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -152,19 +152,19 @@ jobs:shell: bashrun: |OPTS="-sf -m 5"-+# Try Primary v4 -> Fallback v4 -> Default to emptyPUBLIC_IPV4=$(curl $OPTS v4.ident.me || curl $OPTS 4.tnedi.me || true)-+# Try Primary v6 -> Fallback v6 -> Default to emptyPUBLIC_IPV6=$(curl $OPTS v6.ident.me || curl $OPTS 6.tnedi.me || true)-+# Validation: Ensure at least one IP was foundif [[ -z "$PUBLIC_IPV4" && -z "$PUBLIC_IPV6" ]]; thenecho "::error::Could not determine Public IP (both v4 and v6 failed)."exit 1fi-+echo "ipv4=$PUBLIC_IPV4" >> $GITHUB_OUTPUTecho "ipv6=$PUBLIC_IPV6" >> $GITHUB_OUTPUT@@ -692,6 +692,16 @@ jobs:env:VERSION: ${{ steps.get-version-details.outputs.version_with_qualifier }}+ - name: Run Spotless backend check+ id: run-spotless-backend-check+ if: steps.backend-files-changed.outputs.any_modified == 'true'+ run: ./gradlew spotlessBackendCheck++ - name: Run Spotless UI check+ id: run-spotless-frontend-check+ if: steps.ui-files-changed.outputs.any_modified == 'true'+ run: ./gradlew spotlessUiCheck+- name: Check for outdated translationsif: steps.is_main_repo.outputs.value == 'true'run: |diff --git a/.github/workflows/custom-review.yml b/.github/workflows/custom-review.ymlindex 75a6972a2..928f6aa19 100644--- a/.github/workflows/custom-review.yml+++ b/.github/workflows/custom-review.yml@@ -39,6 +39,22 @@ jobs:- '!**/*.yml'- '!yarn.lock'+ check-spotless:+ name: Lint+ needs: detect-changes+ if: ${{ !failure() && !cancelled() }}+ uses: "./.github/workflows/check-spotless.yml"+ with:+ skip: ${{ needs.detect-changes.outputs.backend_any_modified != 'true' }}++ ui-check-spotless:+ name: Lint+ needs: detect-changes+ if: ${{ !failure() && !cancelled() }}+ uses: "./.github/workflows/ui-check-spotless.yml"+ with:+ skip: ${{ needs.detect-changes.outputs.ui_any_modified != 'true' }}+install-dist:name: Buildneeds: detect-changesdiff --git a/.github/workflows/custom-staging.yml b/.github/workflows/custom-staging.ymlindex 3903a4668..f9ba9e8cf 100644--- a/.github/workflows/custom-staging.yml+++ b/.github/workflows/custom-staging.yml@@ -39,6 +39,22 @@ jobs:- '!**/*.yml'- '!yarn.lock'+ check-spotless:+ name: Lint+ needs: detect-changes+ if: ${{ !failure() && !cancelled() }}+ uses: "./.github/workflows/check-spotless.yml"+ with:+ skip: ${{ needs.detect-changes.outputs.backend_any_modified != 'true' }}++ ui-check-spotless:+ name: Lint+ needs: detect-changes+ if: ${{ !failure() && !cancelled() }}+ uses: "./.github/workflows/ui-check-spotless.yml"+ with:+ skip: ${{ needs.detect-changes.outputs.ui_any_modified != 'true' }}+install-dist:name: Buildneeds: detect-changesdiff --git a/.github/workflows/review.yml b/.github/workflows/review.ymlindex 5da1eb314..ceebff85b 100644--- a/.github/workflows/review.yml+++ b/.github/workflows/review.yml@@ -47,6 +47,14 @@ jobs:- '!package.json'- '!yarn.lock'+ check-spotless:+ name: Lint+ needs: detect-changes+ if: ${{ !failure() && !cancelled() }}+ uses: "./.github/workflows/check-spotless.yml"+ with:+ skip: ${{ needs.detect-changes.outputs.backend_any_modified != 'true' }}+ui-check-dependencies:name: Lintneeds: detect-changes@@ -55,6 +63,14 @@ jobs:with:skip: ${{ needs.detect-changes.outputs.ui_any_modified != 'true' }}+ ui-check-spotless:+ name: Lint+ needs: detect-changes+ if: ${{ !failure() && !cancelled() }}+ uses: "./.github/workflows/ui-check-spotless.yml"+ with:+ skip: ${{ needs.detect-changes.outputs.ui_any_modified != 'true' }}+ui-check-outdated-translations:name: Lintneeds: detect-changesdiff --git a/.github/workflows/staging.yml b/.github/workflows/staging.ymlindex 0c5283cea..3cc6b4750 100644--- a/.github/workflows/staging.yml+++ b/.github/workflows/staging.yml@@ -76,6 +76,14 @@ jobs:IS_RELEASE: ${{ steps.get-version-details.outputs.is_release }}VERSION: ${{ steps.get-version-details.outputs.version }}+ check-spotless:+ name: Lint+ needs: detect-changes+ if: ${{ !failure() && !cancelled() }}+ uses: "./.github/workflows/check-spotless.yml"+ with:+ skip: ${{ needs.detect-changes.outputs.backend_any_modified != 'true' }}+ui-check-dependencies:name: Lintneeds: detect-changes@@ -84,6 +92,14 @@ jobs:with:skip: ${{ needs.detect-changes.outputs.ui_any_modified != 'true' }}+ ui-check-spotless:+ name: Lint+ needs: detect-changes+ if: ${{ !failure() && !cancelled() }}+ uses: "./.github/workflows/ui-check-spotless.yml"+ with:+ skip: ${{ needs.detect-changes.outputs.ui_any_modified != 'true' }}+ui-check-outdated-translations:name: Lintneeds: detect-changesdiff --git a/.github/workflows/ui-check-spotless.yml b/.github/workflows/ui-check-spotless.ymlnew file mode 100644index 000000000..a9ad93f6b--- /dev/null+++ b/.github/workflows/ui-check-spotless.yml@@ -0,0 +1,25 @@+name: UI Check Spotless+on:+ workflow_call:+ inputs:+ skip:+ type: boolean+ description: Skip condition to allow branch protection checks to pass+ default: false++jobs:+ ui-check-spotless:+ name: UI Check Spotless+ if: ${{ !inputs.skip }}+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ - name: Set up JDK 21 and gradle cache+ uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0+ with:+ distribution: "temurin"+ java-version: "21"+ cache: "gradle"+ - name: Check Spotless+ timeout-minutes: 20+ run: ./gradlew spotlessUiCheck