32
32
run : |
33
33
echo "separateTestsNames=$(./gradlew listTasksAsJSON -q --console=plain | tail -n 1)" >> $GITHUB_OUTPUT
34
34
35
+ publish-components-to-maven-local :
36
+ runs-on : ubuntu-latest
37
+ steps :
38
+ - name : Set up JDK for build and test
39
+ uses : actions/setup-java@v4
40
+ with :
41
+ distribution : temurin # Temurin is a distribution of adoptium
42
+ java-version : 21
43
+
44
+ - name : Checkout security
45
+ uses : actions/checkout@v4
46
+
47
+ - name : Publish components to Maven Local
48
+ run : |
49
+ ./gradlew clean \
50
+ :opensearch-resource-sharing-spi:publishToMavenLocal \
51
+ -Dbuild.snapshot=false
52
+
53
+ - name : Cache artifacts for dependent jobs
54
+
55
+ with :
56
+ path : ~/.m2/repository/org/opensearch/
57
+ key : maven-local-${{ github.run_id }}
58
+ restore-keys : |
59
+ maven-local-
60
+
35
61
test :
36
62
name : test
37
- needs : generate-test-list
63
+ needs : [ generate-test-list, publish-components-to-maven-local]
38
64
strategy :
39
65
fail-fast : false
40
66
matrix :
53
79
- name : Checkout security
54
80
uses : actions/checkout@v4
55
81
82
+ - name : Restore Maven Local Cache
83
+
84
+ with :
85
+ path : ~/.m2/repository/org/opensearch/
86
+ key : maven-local-${{ github.run_id }}
87
+ restore-keys : |
88
+ maven-local-
89
+
56
90
- name : Build and Test
57
91
uses : gradle/gradle-build-action@v3
58
92
with :
68
102
./build/reports/
69
103
70
104
report-coverage :
71
- needs : ["test", "integration-tests"]
105
+ needs : ["test", "integration-tests", "spi-tests" ]
72
106
runs-on : ubuntu-latest
73
107
steps :
74
108
- uses : actions/checkout@v4
91
125
fail_ci_if_error: true
92
126
verbose: true
93
127
94
-
95
128
integration-tests :
96
129
name : integration-tests
97
130
strategy :
@@ -111,12 +144,20 @@ jobs:
111
144
- name : Checkout security
112
145
uses : actions/checkout@v4
113
146
114
- - name : Build and Test
147
+ - name : Restore Maven Local Cache
148
+
149
+ with :
150
+ path : ~/.m2/repository/org/opensearch/
151
+ key : maven-local-${{ github.run_id }}
152
+ restore-keys : |
153
+ maven-local-
154
+
155
+ - name : Run Integration Tests
115
156
uses : gradle/gradle-build-action@v3
116
157
with :
117
158
cache-disabled : true
118
159
arguments : |
119
- integrationTest -Dbuild.snapshot=false
160
+ : integrationTest -Dbuild.snapshot=false
120
161
121
162
- uses : actions/upload-artifact@v4
122
163
if : always()
@@ -125,10 +166,52 @@ jobs:
125
166
path : |
126
167
./build/reports/
127
168
169
+ spi-tests :
170
+ name : spi-tests
171
+ needs : publish-components-to-maven-local
172
+ strategy :
173
+ fail-fast : false
174
+ matrix :
175
+ jdk : [21]
176
+ platform : [ubuntu-latest, windows-latest]
177
+ runs-on : ${{ matrix.platform }}
178
+
179
+ steps :
180
+ - name : Set up JDK for build and test
181
+ uses : actions/setup-java@v4
182
+ with :
183
+ distribution : temurin # Temurin is a distribution of adoptium
184
+ java-version : ${{ matrix.jdk }}
185
+
186
+ - name : Checkout security
187
+ uses : actions/checkout@v4
188
+
189
+ - name : Restore Maven Local Cache
190
+
191
+ with :
192
+ path : ~/.m2/repository/org/opensearch/
193
+ key : maven-local-${{ github.run_id }}
194
+ restore-keys : |
195
+ maven-local-
196
+
197
+ - name : Run SPI Tests
198
+ uses : gradle/gradle-build-action@v3
199
+ with :
200
+ cache-disabled : true
201
+ arguments : |
202
+ :opensearch-resource-sharing-spi:test -Dbuild.snapshot=false
203
+
204
+ - uses : actions/upload-artifact@v4
205
+ if : always()
206
+ with :
207
+ name : spi-${{ matrix.platform }}-JDK${{ matrix.jdk }}-reports
208
+ path : |
209
+ ./build/reports/
128
210
129
211
resource-tests :
130
212
env :
131
213
CI_ENVIRONMENT : resource-test
214
+ needs : publish-components-to-maven-local
132
215
strategy :
133
216
fail-fast : false
134
217
matrix :
@@ -146,12 +229,20 @@ jobs:
146
229
- name : Checkout security
147
230
uses : actions/checkout@v4
148
231
149
- - name : Build and Test
232
+ - name : Restore Maven Local Cache
233
+
234
+ with :
235
+ path : ~/.m2/repository/org/opensearch/
236
+ key : maven-local-${{ github.run_id }}
237
+ restore-keys : |
238
+ maven-local-
239
+
240
+ - name : Run Resource Tests
150
241
uses : gradle/gradle-build-action@v3
151
242
with :
152
243
cache-disabled : true
153
244
arguments : |
154
- integrationTest -Dbuild.snapshot=false --tests org.opensearch.security.ResourceFocusedTests
245
+ : integrationTest -Dbuild.snapshot=false --tests org.opensearch.security.ResourceFocusedTests
155
246
156
247
backward-compatibility-build :
157
248
runs-on : ubuntu-latest
@@ -214,40 +305,62 @@ jobs:
214
305
build-artifact-names :
215
306
runs-on : ubuntu-latest
216
307
steps :
217
- - uses : actions/checkout@v4
308
+ - name : Setup Environment
309
+ uses : actions/checkout@v4
218
310
219
- - uses : actions/setup-java@v4
311
+ - name : Configure Java
312
+ uses : actions/setup-java@v4
220
313
with :
221
- distribution : temurin # Temurin is a distribution of adoptium
314
+ distribution : temurin
222
315
java-version : 21
223
316
224
- - run : |
225
- security_plugin_version=$(./gradlew properties -q | grep -E '^version:' | awk '{print $2}')
226
- security_plugin_version_no_snapshot=$(echo $security_plugin_version | sed 's/-SNAPSHOT//g')
227
- security_plugin_version_only_number=$(echo $security_plugin_version_no_snapshot | cut -d- -f1)
228
- test_qualifier=alpha2
229
-
230
- echo "SECURITY_PLUGIN_VERSION=$security_plugin_version" >> $GITHUB_ENV
231
- echo "SECURITY_PLUGIN_VERSION_NO_SNAPSHOT=$security_plugin_version_no_snapshot" >> $GITHUB_ENV
232
- echo "SECURITY_PLUGIN_VERSION_ONLY_NUMBER=$security_plugin_version_only_number" >> $GITHUB_ENV
233
- echo "TEST_QUALIFIER=$test_qualifier" >> $GITHUB_ENV
234
-
235
- - run : |
236
- echo ${{ env.SECURITY_PLUGIN_VERSION }}
237
- echo ${{ env.SECURITY_PLUGIN_VERSION_NO_SNAPSHOT }}
238
- echo ${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}
239
- echo ${{ env.TEST_QUALIFIER }}
240
-
241
- - run : ./gradlew clean assemble && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION }}.zip
242
-
243
- - run : ./gradlew clean assemble -Dbuild.snapshot=false && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_NO_SNAPSHOT }}.zip
244
-
245
- - run : ./gradlew clean assemble -Dbuild.snapshot=false -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}.zip
246
-
247
- - run : ./gradlew clean assemble -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}-SNAPSHOT.zip
248
-
249
- - run : ./gradlew clean publishPluginZipPublicationToZipStagingRepository && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION }}.zip && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION }}.pom
250
-
251
- - name : List files in the build directory if there was an error
252
- run : ls -al ./build/distributions/
317
+ - name : Build and Test Artifacts
318
+ run : |
319
+ # Set version variables
320
+ security_plugin_version=$(./gradlew properties -q | grep -E '^version:' | awk '{print $2}')
321
+ security_plugin_version_no_snapshot=$(echo $security_plugin_version | sed 's/-SNAPSHOT//g')
322
+ security_plugin_version_only_number=$(echo $security_plugin_version_no_snapshot | cut -d- -f1)
323
+ test_qualifier=alpha2
324
+
325
+ # Debug print versions
326
+ echo "Versions:"
327
+ echo $security_plugin_version
328
+ echo $security_plugin_version_no_snapshot
329
+ echo $security_plugin_version_only_number
330
+ echo $test_qualifier
331
+
332
+ # Publish SPI
333
+ ./gradlew clean :opensearch-resource-sharing-spi:publishToMavenLocal && test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version-all.jar
334
+ ./gradlew clean :opensearch-resource-sharing-spi:publishToMavenLocal -Dbuild.snapshot=false && test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version_no_snapshot-all.jar
335
+ ./gradlew clean :opensearch-resource-sharing-spi:publishToMavenLocal -Dbuild.snapshot=false -Dbuild.version_qualifier=$test_qualifier && test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version_only_number-$test_qualifier-all.jar
336
+ ./gradlew clean :opensearch-resource-sharing-spi:publishToMavenLocal -Dbuild.version_qualifier=$test_qualifier && test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version_only_number-$test_qualifier-SNAPSHOT-all.jar
337
+
338
+
339
+ # Build artifacts
340
+ ./gradlew clean assemble && \
341
+ test -s ./build/distributions/opensearch-security-$security_plugin_version.zip && \
342
+ test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version.jar
343
+
344
+ ./gradlew clean assemble -Dbuild.snapshot=false && \
345
+ test -s ./build/distributions/opensearch-security-$security_plugin_version_no_snapshot.zip && \
346
+ test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version_no_snapshot.jar
347
+
348
+ ./gradlew clean assemble -Dbuild.snapshot=false -Dbuild.version_qualifier=$test_qualifier && \
349
+ test -s ./build/distributions/opensearch-security-$security_plugin_version_only_number-$test_qualifier.zip && \
350
+ test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version_only_number-$test_qualifier.jar
351
+
352
+ ./gradlew clean assemble -Dbuild.version_qualifier=$test_qualifier && \
353
+ test -s ./build/distributions/opensearch-security-$security_plugin_version_only_number-$test_qualifier-SNAPSHOT.zip && \
354
+ test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version_only_number-$test_qualifier-SNAPSHOT.jar
355
+
356
+ ./gradlew clean publishPluginZipPublicationToZipStagingRepository && \
357
+ test -s ./build/distributions/opensearch-security-$security_plugin_version.zip && \
358
+ test -s ./build/distributions/opensearch-security-$security_plugin_version.pom && \
359
+ test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version-all.jar
360
+
361
+ ./gradlew clean publishShadowPublicationToMavenLocal && \
362
+ test -s ./spi/build/libs/opensearch-resource-sharing-spi-$security_plugin_version-all.jar
363
+
364
+ - name : List files in build directory on failure
253
365
if : failure()
366
+ run : ls -al ./*/build/libs/ ./build/distributions/
0 commit comments