Skip to content

Commit 7f42329

Browse files
Separate Spotless Check to JDK 17 and Exclude from other Build Process (opensearch-project#3354)
* Modify to run spotless separately with JDK 17 to avoid spotlessJava errors Signed-off-by: rithin-pullela-aws <rithinp@amazon.com> * Add spotless check in build-ml-linux step Signed-off-by: rithin-pullela-aws <rithinp@amazon.com> * Use Java 21 for spotless and do not force to run on ubuntu Signed-off-by: rithin-pullela-aws <rithinp@amazon.com> * Add spotless as needed for all the steps Signed-off-by: rithin-pullela-aws <rithinp@amazon.com> --------- Signed-off-by: rithin-pullela-aws <rithinp@amazon.com>
1 parent f741f71 commit 7f42329

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

.github/workflows/CI-workflow.yml

+21-10
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: [11, 17, 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: [11, 17, 21]
@@ -167,10 +178,10 @@ jobs:
167178
if [ $security -gt 0 ]
168179
then
169180
echo "Security plugin is available"
170-
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=${{ steps.genpass.outputs.password }}
181+
./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
171182
else
172183
echo "Security plugin is NOT available"
173-
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster"
184+
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -x spotlessJava
174185
fi
175186
176187
- name: Upload Coverage Report
@@ -185,7 +196,7 @@ jobs:
185196
java: [11, 17, 21]
186197
name: Build and Test MLCommons Plugin on Windows
187198
if: github.repository == 'opensearch-project/ml-commons'
188-
needs: [Get-Require-Approval]
199+
needs: [Get-Require-Approval, spotless]
189200
environment: ${{ needs.Get-Require-Approval.outputs.is-require-approval }}
190201
runs-on: windows-latest
191202

@@ -213,10 +224,10 @@ jobs:
213224
export COHERE_KEY=$(aws secretsmanager get-secret-value --secret-id github_cohere_key --query SecretString --output text)
214225
echo "::add-mask::$OPENAI_KEY"
215226
echo "::add-mask::$COHERE_KEY"
216-
./gradlew.bat build
227+
./gradlew.bat build -x spotlessJava
217228
- name: Publish to Maven Local
218229
run: |
219-
./gradlew publishToMavenLocal
230+
./gradlew publishToMavenLocal -x spotlessJava
220231
# - name: Multi Nodes Integration Testing
221232
# shell: bash
222233
# run: |

0 commit comments

Comments
 (0)