Skip to content

Commit 5fd7450

Browse files
Add Spotless Check to maintain consistency (opensearch-project#3386)
Add Spotless check step to main branch to maintain workflow consistency with 2.x branch. While version compatibility is only an issue in 2.x, maintaining parallel workflow structure prevents branch drift and simplifies future maintenance. Signed-off-by: rithin-pullela-aws <[email protected]>
1 parent bcb00d1 commit 5fd7450

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

.github/workflows/CI-workflow.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,19 @@ jobs:
2222
with:
2323
product: opensearch
2424

25+
spotless:
26+
steps:
27+
- uses: actions/checkout@v4
28+
# Spotless requires JDK 17+
29+
- name: Setup Java 21
30+
uses: actions/setup-java@v1
31+
with:
32+
java-version: 21
33+
- name: Spotless Check
34+
run: ./gradlew spotlessCheck
35+
2536
Build-ml-linux:
26-
needs: [Get-Require-Approval, Get-CI-Image-Tag]
37+
needs: [Get-Require-Approval, Get-CI-Image-Tag, spotless]
2738
strategy:
2839
matrix:
2940
java: [21]
@@ -66,9 +77,9 @@ jobs:
6677
export COHERE_KEY=`aws secretsmanager get-secret-value --secret-id github_cohere_key --query SecretString --output text` &&
6778
echo "::add-mask::$OPENAI_KEY" &&
6879
echo "::add-mask::$COHERE_KEY" &&
69-
echo "build and run tests" && ./gradlew build &&
70-
echo "Publish to Maven Local" && ./gradlew publishToMavenLocal &&
71-
echo "Multi Nodes Integration Testing" && ./gradlew integTest -PnumNodes=3'
80+
echo "build and run tests" && ./gradlew build -x spotlessJava &&
81+
echo "Publish to Maven Local" && ./gradlew publishToMavenLocal -x spotlessJava &&
82+
echo "Multi Nodes Integration Testing" && ./gradlew integTest -PnumNodes=3 -x spotlessJava'
7283
plugin=`basename $(ls plugin/build/distributions/*.zip)`
7384
echo $plugin
7485
mv -v plugin/build/distributions/$plugin ./
@@ -88,7 +99,7 @@ jobs:
8899

89100

90101
Test-ml-linux-docker:
91-
needs: [Get-Require-Approval, Build-ml-linux]
102+
needs: [Get-Require-Approval, Build-ml-linux, spotless]
92103
strategy:
93104
matrix:
94105
java: [21]
@@ -172,10 +183,10 @@ jobs:
172183
if [ $security -gt 0 ]
173184
then
174185
echo "Security plugin is available"
175-
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=${{ steps.genpass.outputs.password }}
186+
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=${{ steps.genpass.outputs.password }} -x spotlessJava
176187
else
177188
echo "Security plugin is NOT available"
178-
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster"
189+
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -x spotlessJava
179190
fi
180191
181192
- name: Upload Coverage Report
@@ -190,7 +201,7 @@ jobs:
190201
java: [21]
191202
name: Build and Test MLCommons Plugin on Windows
192203
if: github.repository == 'opensearch-project/ml-commons'
193-
needs: [Get-Require-Approval]
204+
needs: [Get-Require-Approval, spotless]
194205
environment: ${{ needs.Get-Require-Approval.outputs.is-require-approval }}
195206
runs-on: windows-latest
196207

@@ -218,10 +229,10 @@ jobs:
218229
export COHERE_KEY=$(aws secretsmanager get-secret-value --secret-id github_cohere_key --query SecretString --output text)
219230
echo "::add-mask::$OPENAI_KEY"
220231
echo "::add-mask::$COHERE_KEY"
221-
./gradlew.bat build
232+
./gradlew.bat build -x spotlessJava
222233
- name: Publish to Maven Local
223234
run: |
224-
./gradlew publishToMavenLocal
235+
./gradlew publishToMavenLocal -x spotlessJava
225236
# - name: Multi Nodes Integration Testing
226237
# shell: bash
227238
# run: |

0 commit comments

Comments
 (0)