4141 runs-on : ubuntu-22.04
4242 timeout-minutes : 10
4343 env :
44- CACHE_VERSION : 1 # bump this to run all clients on the CI.
44+ CACHE_VERSION : 1.02 # bump this to run all clients on the CI.
4545 steps :
4646 - name : debugging - dump GitHub context
4747 env :
@@ -146,7 +146,7 @@ jobs:
146146 run : yarn scripts:test
147147
148148 - name : Lint custom eslint plugin
149- run : yarn workspace eslint-plugin-automation-custom lint
149+ run : yarn cli format javascript eslint
150150
151151 - name : Test custom eslint plugin
152152 run : yarn workspace eslint-plugin-automation-custom test
@@ -174,7 +174,7 @@ jobs:
174174 path : ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).bundledPath }}
175175
176176 client_gen_javascript :
177- timeout-minutes : 10
177+ timeout-minutes : 15
178178 runs-on : ubuntu-22.04
179179 needs :
180180 - setup
@@ -199,12 +199,10 @@ jobs:
199199 type : specs
200200
201201 - name : Remove generated clients
202- if : ${{ startsWith(env .head_ref, 'chore/prepare-release-') }}
202+ if : ${{ startsWith(github .head_ref, 'chore/prepare-release-') }}
203203 run : |
204204 cd clients/algoliasearch-client-javascript/packages
205- ls | grep -v -E "(client-common|requester-*|algoliasearch)" | xargs rm -rf
206- cd algoliasearch
207- ls | grep -v -E "__tests__" | xargs rm -rf
205+ find . -mindepth 1 -maxdepth 1 ! -name 'requester-*' ! -name 'logger-*' ! -name 'client-common' -type d -exec rm -rf {}/src {}/model {}/dist {}/builds \;
208206
209207 - name : Setup
210208 uses : ./.github/actions/setup
@@ -222,17 +220,17 @@ jobs:
222220 run : ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).buildCommand }}
223221
224222 - name : Build the playground
225- run : yarn cli build playground javascript
223+ run : yarn cli build playground javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
226224
227225 - name : Run common and requester tests
228226 run : cd clients/algoliasearch-client-javascript && yarn test ${{ !contains(fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun, 'algoliasearch') && '--ignore algoliasearch' || '' }}
229227
230228 - name : Test JavaScript bundle size
231- if : ${{ startsWith(env .head_ref, 'chore/prepare-release-') }}
229+ if : ${{ startsWith(github .head_ref, 'chore/prepare-release-') }}
232230 run : cd clients/algoliasearch-client-javascript && yarn test:size
233231
234232 - name : Test JavaScript bundle and types
235- if : ${{ startsWith(env .head_ref, 'chore/prepare-release-') }}
233+ if : ${{ startsWith(github .head_ref, 'chore/prepare-release-') }}
236234 run : cd clients/algoliasearch-client-javascript && yarn test:bundle
237235
238236 - name : Remove previous CTS output
@@ -269,17 +267,26 @@ jobs:
269267 run : yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
270268
271269 - name : Retry e2e CTS
272- if : ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }}
270+ if : ${{ steps.cts-e2e.outcome == 'failure' }}
273271 run : yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
274272
275273 - name : Run benchmarks
276274 run : yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --benchmark --no-client --no-requests --no-e2e
277275
278- - name : Generate code snippets for documentation
276+ - name : Generate code snippets
279277 run : yarn cli snippets javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
278+
279+ - name : Build the snippets to check validity
280+ run : yarn cli build snippets javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
281+
282+ - name : Generate code guides
283+ run : yarn cli guides javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
284+
285+ - name : Build the guides to check validity
286+ run : yarn cli build guides javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
280287
281288 - name : Zip artifact before storing
282- run : zip -r -y clients-javascript.zip clients/algoliasearch-client-javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).testsToStore }} ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).snippetsToStore }} -x "**/node_modules**" "**/.yarn/cache/**" "**/.yarn/install-state.gz" "**/build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/.nx/**"
289+ run : zip -r -y clients-javascript.zip clients/algoliasearch-client-javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).testsToStore }} ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).guidesToStore }} -x "**/node_modules**" "**/.yarn/cache/**" "**/.yarn/install-state.gz" "**/build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/.nx/**"
283290
284291 - name : Store javascript clients
285292 uses : actions/upload-artifact@v4
@@ -326,7 +333,7 @@ jobs:
326333 run : yarn cli generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}
327334
328335 - name : Update composer.lock
329- if : ${{ matrix.client.language == 'php' && startsWith(env .head_ref, 'chore/renovateBaseBranch') && matrix.client.isMainVersion }}
336+ if : ${{ matrix.client.language == 'php' && startsWith(github .head_ref, 'chore/renovateBaseBranch') && matrix.client.isMainVersion }}
330337 run : cd ${{ matrix.client.path }} && composer update
331338
332339 - name : Check for file duplicates in Swift
@@ -374,22 +381,28 @@ jobs:
374381 run : yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
375382
376383 - name : Retry e2e CTS
377- if : ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }}
384+ if : ${{ steps.cts-e2e.outcome == 'failure' }}
378385 run : yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
379386
380387 - name : Run benchmarks
381388 if : ${{ matrix.client.isMainVersion }}
382389 run : yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --benchmark --no-client --no-requests --no-e2e
383390
384- - name : Generate code snippets for documentation
391+ - name : Generate code snippets
385392 run : yarn cli snippets ${{ matrix.client.language }} ${{ matrix.client.toRun }}
386393
387394 - name : Build the snippets to check validity
388395 run : yarn cli build snippets ${{ matrix.client.language }}
389396
397+ - name : Generate code guides
398+ run : yarn cli guides ${{ matrix.client.language }} ${{ matrix.client.toRun }}
399+
400+ - name : Build the guides to check validity
401+ run : yarn cli build guides ${{ matrix.client.language }}
402+
390403 - name : Zip artifact before storing
391404 if : ${{ matrix.client.isMainVersion }}
392- run : zip -r -y clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} ${{ matrix.client.testsToStore }} ${{ matrix.client.snippetsToStore }} -x "**/node_modules**" "**/__pycache__/**" "**/.yarn/cache/**" "**/build/**" "**/.build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/vendor/**" "**/target/**" "**/.dart_tool/**"
405+ run : zip -r -y clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} ${{ matrix.client.testsToStore }} ${{ matrix.client.guidesToStore }} -x "**/node_modules**" "**/__pycache__/**" "**/.yarn/cache/**" "**/build/**" "**/.build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/vendor/**" "**/target/**" "**/.dart_tool/**"
393406
394407 - name : Store ${{ matrix.client.language }} clients
395408 if : ${{ matrix.client.isMainVersion }}
@@ -464,23 +477,27 @@ jobs:
464477 name : client swift${{ needs.setup.outputs.RUN_MACOS_SWIFT_CTS == 'true' && format('@{0}', fromJSON(needs.setup.outputs.SWIFT_DATA).version) || '' }} macos
465478 steps :
466479 - uses : actions/checkout@v4
480+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
467481
468482 - name : Download artifacts
469483 uses : ./scripts/ci/actions/restore-artifacts
484+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
470485 with :
471486 type : languages
472487 languages : |
473488 swift
474489
475490 - name : Setup
476491 uses : ./.github/actions/setup
492+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
477493 with :
478494 type : minimal
479495 language : swift
480496 version : ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}
481497
482498 - name : Run tests on macOS
483499 id : run-test
500+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
484501 continue-on-error : true
485502 run : yarn cli cts run swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }} -v ${{ !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') && '--no-e2e' || '' }}
486503
@@ -513,7 +530,7 @@ jobs:
513530 with :
514531 fetch-depth : 0
515532 ref : ${{ github.event.pull_request.head.ref }}
516- token : ${{ secrets.ALGOLIA_BOT_TOKEN }}
533+ token : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
517534 repository : ${{ github.event.pull_request.head.repo.full_name }}
518535
519536 - name : Download all artifacts
@@ -557,14 +574,14 @@ jobs:
557574 id : pushGeneratedCode
558575 run : yarn workspace scripts pushGeneratedCode
559576 env :
560- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
577+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
561578 PR_NUMBER : ${{ github.event.number }}
562579
563580 - name : update generation comment
564581 uses : marocchino/sticky-pull-request-comment@v2
565582 if : ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT == '' }}
566583 with :
567- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
584+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
568585 message : |
569586 ### No code generated
570587
@@ -576,7 +593,7 @@ jobs:
576593 uses : marocchino/sticky-pull-request-comment@v2
577594 if : ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT != '' }}
578595 with :
579- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
596+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
580597 message : |
581598 ### ✔️ Code generated!
582599
@@ -670,7 +687,12 @@ jobs:
670687 env :
671688 GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
672689
673- - name : Push generation to the Algolia docs
690+ - name : Push specs and snippets to algolia/doc
674691 run : yarn workspace scripts pushToAlgoliaDoc
675692 env :
676693 GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
694+
695+ - name : Push guides to algolia/AlgoliaWeb
696+ run : yarn workspace scripts pushToAlgoliaWeb
697+ env :
698+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
0 commit comments