Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Add Spotless checks to CI/CD

Wouter Bornd6941d97c96a
diff --git a/.github/workflows/check-spotless.yml b/.github/workflows/check-spotless.yml
new file mode 100644
index 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 spotlessBackendCheck
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index 97417194c..28f3c4fcb 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -152,19 +152,19 @@ jobs:
shell: bash
run: |
OPTS="-sf -m 5"
-
+
# Try Primary v4 -> Fallback v4 -> Default to empty
PUBLIC_IPV4=$(curl $OPTS v4.ident.me || curl $OPTS 4.tnedi.me || true)
-
+
# Try Primary v6 -> Fallback v6 -> Default to empty
PUBLIC_IPV6=$(curl $OPTS v6.ident.me || curl $OPTS 6.tnedi.me || true)
-
+
# Validation: Ensure at least one IP was found
if [[ -z "$PUBLIC_IPV4" && -z "$PUBLIC_IPV6" ]]; then
echo "::error::Could not determine Public IP (both v4 and v6 failed)."
exit 1
fi
-
+
echo "ipv4=$PUBLIC_IPV4" >> $GITHUB_OUTPUT
echo "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 translations
if: steps.is_main_repo.outputs.value == 'true'
run: |
diff --git a/.github/workflows/custom-review.yml b/.github/workflows/custom-review.yml
index 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: Build
needs: detect-changes
diff --git a/.github/workflows/custom-staging.yml b/.github/workflows/custom-staging.yml
index 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: Build
needs: detect-changes
diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml
index 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: Lint
needs: 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: Lint
needs: detect-changes
diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml
index 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: Lint
needs: 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: Lint
needs: detect-changes
diff --git a/.github/workflows/ui-check-spotless.yml b/.github/workflows/ui-check-spotless.yml
new file mode 100644
index 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