62
62
diff=$(git status --porcelain ./scripts/ci/actions | wc -l)
63
63
64
64
if [[ $diff > 0 ]]; then
65
- echo "Build the custom github actions by running `yarn workspace scripts build:actions`"
65
+ echo "Build the custom github actions by running \ `yarn workspace scripts build:actions\ `"
66
66
fi
67
67
68
68
exit $diff
96
96
JAVASCRIPT_DATA : ${{ steps.gen-matrix.outputs.JAVASCRIPT_DATA }}
97
97
RUN_GEN_JAVASCRIPT : ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT }}
98
98
99
+ SWIFT_DATA : ${{ steps.gen-matrix.outputs.SWIFT_DATA }}
100
+ RUN_MACOS_SWIFT_CTS : ${{ steps.gen-matrix.outputs.RUN_MACOS_SWIFT_CTS }}
101
+
99
102
scripts :
100
103
runs-on : ubuntu-22.04
101
104
timeout-minutes : 10
@@ -125,21 +128,12 @@ jobs:
125
128
steps :
126
129
- uses : actions/checkout@v4
127
130
128
- - name : Cache bundled specs
129
- id : cache
130
- uses : actions/cache@v4
131
- with :
132
- key : ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).cacheKey }}
133
- path : ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).bundledPath }}
134
-
135
131
- name : Setup
136
- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
137
132
uses : ./.github/actions/setup
138
133
with :
139
134
type : minimal
140
135
141
136
- name : Building specs
142
- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
143
137
run : yarn cli build specs ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).toRun }}
144
138
145
139
- name : Store bundled specs
@@ -170,7 +164,7 @@ jobs:
170
164
uses : actions/cache@v4
171
165
with :
172
166
key : |
173
- ${{ matrix.client }}-${{ env.CACHE_VERSION }}-${{ hashFiles(
167
+ ${{ matrix.client }}-${{ hashFiles(
174
168
format('clients/algoliasearch-client-javascript/packages/{0}/**', matrix.client),
175
169
'clients/algoliasearch-client-javascript/yarn.lock'
176
170
)}}
@@ -215,22 +209,13 @@ jobs:
215
209
steps :
216
210
- uses : actions/checkout@v4
217
211
218
- - name : Cache clients folder
219
- if : ${{ github.ref != 'refs/heads/main' }}
220
- id : cache
221
- uses : actions/cache@v4
222
- with :
223
- key : ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).cacheKey }}
224
- path : ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).path }}
225
-
226
212
- name : Download specs artifacts
227
- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
228
213
uses : ./scripts/ci/actions/restore-artifacts
229
214
with :
230
215
type : specs
231
216
232
217
- name : Remove generated clients
233
- if : ${{ steps.cache.outputs.cache-hit != 'true' && startsWith(env.head_ref, 'chore/prepare-release-') }}
218
+ if : ${{ startsWith(env.head_ref, 'chore/prepare-release-') }}
234
219
run : |
235
220
cd clients/algoliasearch-client-javascript/packages
236
221
ls | grep -v -E "(client-common|requester-*|algoliasearch)" | xargs rm -rf
@@ -243,22 +228,20 @@ jobs:
243
228
language : javascript
244
229
245
230
- name : Generate clients
246
- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
247
231
run : yarn cli generate javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
248
232
249
233
- name : Update `yarn.lock` for JavaScript
250
234
run : cd clients/algoliasearch-client-javascript && YARN_ENABLE_HARDENED_MODE=0 YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
251
235
252
236
- name : Build clients
253
- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
254
237
run : ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).buildCommand }}
255
238
256
239
- name : Test JavaScript bundle size
257
- if : ${{ steps.cache.outputs.cache-hit != 'true' && startsWith(env.head_ref, 'chore/prepare-release-') }}
240
+ if : ${{ startsWith(env.head_ref, 'chore/prepare-release-') }}
258
241
run : cd clients/algoliasearch-client-javascript && yarn test:size
259
242
260
243
- name : Run JavaScript 'algoliasearch' client tests
261
- if : ${{ steps.cache.outputs.cache-hit != 'true' && contains(fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun,'algoliasearch') }}
244
+ if : ${{ contains(fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun,'algoliasearch') }}
262
245
run : cd clients/algoliasearch-client-javascript && yarn workspace algoliasearch test
263
246
264
247
- name : Remove previous CTS output
@@ -277,14 +260,13 @@ jobs:
277
260
uses : actions/cache@v4
278
261
with :
279
262
path : ${{ steps.yarn-cache-dir-tests.outputs.dir || 'tests/output/javascript/.yarn/cache' }}
280
- # let yarn handle the cache hash
281
- key : yarn-cache-tests-${{ env.CACHE_VERSION }}
263
+ key : yarn-cache-tests-${{ hashFiles('tests/output/javascript/yarn.lock') }}
282
264
283
265
- name : Cache js tests node modules
284
266
uses : actions/cache@v4
285
267
with :
286
268
path : tests/output/javascript/node_modules
287
- key : node-modules-tests-${{ env.CACHE_VERSION }}-${{ hashFiles('tests/output/javascript/yarn.lock') }}
269
+ key : node-modules-tests-${{ hashFiles('tests/output/javascript/yarn.lock') }}
288
270
289
271
- name : Run CTS
290
272
run : yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
@@ -304,7 +286,7 @@ jobs:
304
286
305
287
client_gen :
306
288
timeout-minutes : 20
307
- runs-on : ' ubuntu-22.04'
289
+ runs-on : ubuntu-22.04
308
290
needs :
309
291
- setup
310
292
- specs
@@ -324,16 +306,7 @@ jobs:
324
306
steps :
325
307
- uses : actions/checkout@v4
326
308
327
- - name : Cache clients folder
328
- if : ${{ github.ref != 'refs/heads/main' }}
329
- id : cache
330
- uses : actions/cache@v4
331
- with :
332
- key : ${{ matrix.client.cacheKey }}
333
- path : ${{ matrix.client.path }}
334
-
335
309
- name : Download specs artifacts
336
- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
337
310
uses : ./scripts/ci/actions/restore-artifacts
338
311
with :
339
312
type : specs
@@ -344,19 +317,25 @@ jobs:
344
317
language : ${{ matrix.client.language }}
345
318
346
319
- name : Generate clients
347
- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
348
320
run : yarn cli generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}
349
321
350
322
- name : Update composer.lock
351
- if : ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language == 'php' && startsWith(env.head_ref, 'chore/renovateBaseBranch') }}
323
+ if : ${{ matrix.client.language == 'php' && startsWith(env.head_ref, 'chore/renovateBaseBranch') }}
352
324
run : cd ${{ matrix.client.path }} && composer update
353
325
326
+ - name : Check for file duplicates in Swift
327
+ if : ${{ matrix.client.language == 'swift' }}
328
+ run : |
329
+ set -eo pipefail
330
+ cd clients/algoliasearch-client-swift
331
+ find Sources -type f | rev | cut -d '/' -f1 | rev | sort | uniq -d
332
+ [ $(find Sources -type f | rev | cut -d '/' -f1 | rev | sort | uniq -d | wc -l) -gt 0 ] && echo "Duplicates found" && exit 1 || echo "No duplicate found"
333
+
354
334
- name : Build clients
355
- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
356
335
run : ${{ matrix.client.buildCommand }}
357
336
358
337
- name : Run Java 'algoliasearch' public API validation
359
- if : ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language == 'java' }}
338
+ if : ${{ matrix.client.language == 'java' }}
360
339
run : |
361
340
cd ${{ matrix.client.path }}
362
341
./gradlew :api:japicmp || exit 0
@@ -389,15 +368,53 @@ jobs:
389
368
name : clients-${{matrix.client.language }}
390
369
path : clients-${{matrix.client.language }}.zip
391
370
371
+ swift_cts_macos :
372
+ timeout-minutes : 20
373
+ runs-on : macos-latest
374
+ needs :
375
+ - setup
376
+ - client_gen
377
+ if : |
378
+ always() &&
379
+ startsWith(github.head_ref, 'chore/prepare-release-') &&
380
+ needs.setup.outputs.RUN_GEN == 'true' &&
381
+ needs.setup.outputs.RUN_MACOS_SWIFT_CTS == 'true' &&
382
+ !contains(needs.*.result, 'cancelled') &&
383
+ !contains(needs.*.result, 'failure')
384
+ env :
385
+ ALGOLIA_APPLICATION_ID : ${{ secrets.ALGOLIA_APPLICATION_ID }}
386
+ ALGOLIA_ADMIN_KEY : ${{ secrets.ALGOLIA_ADMIN_KEY }}
387
+ MONITORING_API_KEY : ${{ secrets.MONITORING_API_KEY }}
388
+ steps :
389
+ - uses : actions/checkout@v4
390
+
391
+ - name : Download artifacts
392
+ uses : ./scripts/ci/actions/restore-artifacts
393
+ with :
394
+ type : languages
395
+ languages : |
396
+ swift
397
+
398
+ - name : Setup
399
+ uses : ./.github/actions/setup
400
+ with :
401
+ type : minimal
402
+ language : swift
403
+
404
+ - name : Run CTS
405
+ run : yarn cli cts run swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }}
406
+
392
407
codegen :
393
408
runs-on : ubuntu-22.04
394
409
timeout-minutes : 15
395
410
needs :
396
411
- setup
397
412
- client_gen
398
413
- client_gen_javascript
414
+ - swift_cts_macos
399
415
if : |
400
416
always() &&
417
+ (needs.swift_cts_macos.result == 'success' || needs.swift_cts_macos.result == 'skipped') &&
401
418
!contains(needs.*.result, 'cancelled') &&
402
419
!contains(needs.*.result, 'failure')
403
420
outputs :
@@ -410,7 +427,6 @@ jobs:
410
427
token : ${{ secrets.ALGOLIA_BOT_TOKEN }}
411
428
412
429
- name : Download all artifacts
413
- if : ${{ needs.setup.outputs.RUN_GEN == 'true' || needs.setup.outputs.RUN_GEN_JAVASCRIPT == 'true' }}
414
430
uses : ./scripts/ci/actions/restore-artifacts
415
431
with :
416
432
type : all
@@ -421,14 +437,13 @@ jobs:
421
437
type : minimal
422
438
423
439
- name : Generate documentation specs with code snippets
424
- if : ${{ needs.setup.outputs.RUN_GEN == 'true' || needs.setup.outputs.RUN_GEN_JAVASCRIPT == 'true' }}
425
440
run : yarn cli build specs ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).toRun }} --docs
426
441
427
442
- name : Build website
428
443
run : yarn website:build
429
444
430
445
- name : Deploy documentation
431
- uses : nwtgck/actions-netlify@v2.1
446
+ uses : nwtgck/actions-netlify@v3.0
432
447
with :
433
448
publish-dir : ' website/build'
434
449
production-branch : main
0 commit comments