Skip to content

Commit 2790ddc

Browse files
authored
Merge branch 'main' into fix/dio-requester-requestUri
2 parents b683e34 + 7ce84bf commit 2790ddc

File tree

3,069 files changed

+48767
-52794
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,069 files changed

+48767
-52794
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ composer.json
66
tsconfig.json
77
vendor
88
builddir
9+
foo

.eslintrc.cjs

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -79,136 +79,6 @@ module.exports = {
7979
'yml/no-empty-mapping-value': 0,
8080
},
8181
},
82-
{
83-
// es linter
84-
files: ['*.ts', '*.js'],
85-
86-
extends: [
87-
'algolia',
88-
'algolia/typescript',
89-
'plugin:import/errors',
90-
'plugin:import/warnings',
91-
'plugin:import/typescript',
92-
],
93-
94-
env: {
95-
es6: true,
96-
},
97-
98-
parser: '@typescript-eslint/parser',
99-
100-
parserOptions: {
101-
tsconfigRootDir: __dirname,
102-
project: './**/tsconfig.json',
103-
},
104-
105-
settings: {
106-
'import/extensions': ['.js', '.ts'],
107-
'import/parsers': {
108-
'@typescript-eslint/parser': ['.ts'],
109-
},
110-
'import/ignore': ['node_modules'],
111-
},
112-
113-
plugins: ['algolia', 'unused-imports'],
114-
115-
rules: {
116-
// disabled
117-
'no-bitwise': 0,
118-
'max-classes-per-file': 0,
119-
'no-continue': 0,
120-
'@typescript-eslint/prefer-enum-initializers': 0,
121-
'@typescript-eslint/no-namespace': 0,
122-
'import/dynamic-import-chunkname': 0,
123-
124-
'unused-imports/no-unused-imports-ts': 2,
125-
'@typescript-eslint/no-unused-vars': 2,
126-
'@typescript-eslint/consistent-indexed-object-style': 2,
127-
'@typescript-eslint/member-ordering': [
128-
'error',
129-
{
130-
default: [
131-
'protected-instance-method',
132-
'private-instance-method',
133-
'public-instance-method',
134-
],
135-
},
136-
],
137-
'@typescript-eslint/no-restricted-types': [
138-
'error',
139-
{
140-
types: {
141-
String: {
142-
message: 'Use `string` instead.',
143-
fixWith: 'string',
144-
},
145-
Number: {
146-
message: 'Use `number` instead.',
147-
fixWith: 'number',
148-
},
149-
Boolean: {
150-
message: 'Use `boolean` instead.',
151-
fixWith: 'boolean',
152-
},
153-
Symbol: {
154-
message: 'Use `symbol` instead.',
155-
fixWith: 'symbol',
156-
},
157-
Object: {
158-
message:
159-
'The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848',
160-
fixWith: 'Record<string, unknown>',
161-
},
162-
'{}': {
163-
message:
164-
'The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead.',
165-
fixWith: 'Record<string, unknown>',
166-
},
167-
object: {
168-
message:
169-
'The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848',
170-
fixWith: 'Record<string, unknown>',
171-
},
172-
Function: 'Use a specific function type instead, like `() => void`.',
173-
},
174-
},
175-
],
176-
'jsdoc/match-description': [
177-
'error',
178-
{
179-
matchDescription: '^\n?([A-Z`\[\\d_][\\s\\S]*[.?!`]\\s*)?$'
180-
},
181-
],
182-
},
183-
},
184-
{
185-
files: ['clients/algoliasearch-client-javascript/packages/**/*.ts'],
186-
187-
rules: {
188-
// For a wider browser support (IE>=11), we forbid those two
189-
'no-restricted-syntax': [
190-
'error',
191-
{
192-
selector: "LogicalExpression[operator='??']",
193-
message:
194-
'For wider browser support, nullish coalescing operator is not allowed.',
195-
},
196-
{
197-
selector: 'ChainExpression',
198-
message:
199-
'For wider browser support, optional chaining is not allowed.',
200-
},
201-
],
202-
'@typescript-eslint/prefer-optional-chain': 0,
203-
}
204-
},
205-
{
206-
files: ['clients/algoliasearch-client-javascript/packages/**/__tests__/**/*.ts'],
207-
208-
extends: ["plugin:vitest/legacy-recommended"],
209-
210-
plugins: ['@vitest/eslint-plugin'],
211-
},
21282
{
21383
files: ['*.json'],
21484
parserOptions: {

.github/actions/setup/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ runs:
3434
- name: Download Java formatter
3535
if: inputs.type != 'minimal'
3636
shell: bash
37-
run: curl --retry 3 -L "https://github.com/google/google-java-format/releases/download/v1.23.0/google-java-format-1.23.0-all-deps.jar" > /tmp/java-formatter.jar
37+
run: curl --retry 3 -L "https://github.com/google/google-java-format/releases/download/v1.24.0/google-java-format-1.24.0-all-deps.jar" > /tmp/java-formatter.jar
3838

3939
# JavaScript for monorepo and tooling
4040
- name: Install Node
@@ -45,7 +45,7 @@ runs:
4545

4646
- name: Install JavaScript dependencies
4747
shell: bash
48-
run: YARN_ENABLE_HARDENED_MODE=0 yarn install
48+
run: YARN_ENABLE_HARDENED_MODE=0 YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
4949

5050
- name: Build scripts
5151
shell: bash
@@ -106,7 +106,7 @@ runs:
106106
run: |
107107
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3
108108
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
109-
go install golang.org/x/tools/cmd/goimports@latest
109+
go install golang.org/x/tools/cmd/goimports@v0.22.0
110110
111111
- name: Cache golangci-lint analysis
112112
if: ${{ inputs.language == 'go' }}

.github/workflows/check.yml

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
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 }}

.github/workflows/cleanup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- run: git push -d origin generated/${{ github.head_ref }} || true
17+
- run: git push -d origin "generated/${{ github.head_ref }}" || true

.github/workflows/pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
- name: Pull Request title rules
1717
uses: Slashgear/[email protected]
1818
with:
19-
regexp: '^(docs|chore|snippets)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|playground|csharp|dart|go|java|javascript|kotlin|php|python|ruby|scala|swift|cts|specs|scripts|ci|templates|deps)\)): .+'
19+
regexp: '^(docs|chore|snippets|guides)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|playground|csharp|dart|go|java|javascript|kotlin|php|python|ruby|scala|swift|cts|specs|scripts|ci|templates|deps)\)): .+'

0 commit comments

Comments
 (0)