Skip to content

Commit f065590

Browse files
authored
Merge branch 'main' into fix/dio-requester-requestUri
2 parents 9491108 + c1768b7 commit f065590

File tree

2,422 files changed

+88582
-27888
lines changed

Some content is hidden

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

2,422 files changed

+88582
-27888
lines changed

.eslintrc.cjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,10 @@ module.exports = {
196196
},
197197
{
198198
files: ['*.json'],
199-
200-
plugins: ['json-format'],
199+
parserOptions: {
200+
extraFileExtensions: ['.json'],
201+
},
202+
extends: ["plugin:json/recommended-legacy"]
201203
},
202204
{
203205
files: ['templates/**/*.mustache'],

.github/ISSUE_TEMPLATE/Bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ body:
4343
id: client
4444
attributes:
4545
label: Client
46-
description: What API are you targetting?
46+
description: Which API are you targetting?
4747
options:
4848
- All
4949
- AB testing

.github/actions/setup/action.yml

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ inputs:
99
language:
1010
description: the language for which to install deps
1111
required: false
12+
version:
13+
description: the version of the language to setup
14+
required: false
1215

1316
runs:
1417
using: composite
@@ -48,19 +51,6 @@ runs:
4851
shell: bash
4952
run: yarn workspace scripts build:cli
5053

51-
- name: Get all languages versions
52-
id: versions
53-
shell: bash
54-
run: |
55-
# remove patch from php version
56-
echo "CSHARP_VERSION=$(cat config/.csharp-version)" >> $GITHUB_OUTPUT
57-
echo "DART_VERSION=$(cat config/.dart-version)" >> $GITHUB_OUTPUT
58-
echo "GO_VERSION=$(cat config/.go-version)" >> $GITHUB_OUTPUT
59-
echo "PHP_VERSION=$(cat config/.php-version | cut -d '.' -f 1,2)" >> $GITHUB_OUTPUT
60-
echo "PYTHON_VERSION=$(cat config/.python-version)" >> $GITHUB_OUTPUT
61-
echo "RUBY_VERSION=$(cat config/.ruby-version)" >> $GITHUB_OUTPUT
62-
echo "SWIFT_VERSION=$(cat config/.swift-version)" >> $GITHUB_OUTPUT
63-
6454
# JavaScript client deps
6555
- name: Get yarn js-client cache directory path
6656
if: ${{ inputs.language == 'javascript' }}
@@ -92,7 +82,7 @@ runs:
9282
if: ${{ inputs.language == 'php' }}
9383
uses: shivammathur/setup-php@v2
9484
with:
95-
php-version: ${{ steps.versions.outputs.PHP_VERSION }}
85+
php-version: ${{ inputs.version }}
9686
tools: composer
9787

9888
- name: Run composer install
@@ -108,7 +98,7 @@ runs:
10898
uses: actions/setup-go@v5
10999
with:
110100
cache-dependency-path: clients/algoliasearch-client-go/go.sum
111-
go-version: ${{ steps.versions.outputs.GO_VERSION }}
101+
go-version: ${{ inputs.version }}
112102

113103
- name: Install golangci-lint
114104
if: ${{ inputs.language == 'go' }}
@@ -123,7 +113,7 @@ runs:
123113
uses: actions/cache@v4
124114
with:
125115
path: ~/.cache/golangci-lint
126-
key: golangci-lint-${{ steps.versions.outputs.GO_VERSION }}-${{ hashFiles('clients/algoliasearch-client-go/go.sum') }}
116+
key: golangci-lint-${{ inputs.version }}-${{ hashFiles('clients/algoliasearch-client-go/go.sum') }}
127117

128118
# Kotlin
129119
- name: Cache spotless
@@ -138,7 +128,7 @@ runs:
138128
if: ${{ inputs.language == 'dart' }}
139129
uses: dart-lang/setup-dart@v1
140130
with:
141-
sdk: ${{ steps.versions.outputs.DART_VERSION }}
131+
sdk: ${{ inputs.version }}
142132

143133
- name: Setup dart tools
144134
if: ${{ inputs.language == 'dart' }}
@@ -154,7 +144,7 @@ runs:
154144
- uses: actions/setup-python@v5
155145
if: ${{ inputs.language == 'python' }}
156146
with:
157-
python-version: ${{ steps.versions.outputs.PYTHON_VERSION }}
147+
python-version: ${{ inputs.version }}
158148
cache: 'poetry'
159149

160150
- run: poetry install
@@ -167,7 +157,7 @@ runs:
167157
if: ${{ inputs.language == 'ruby' }}
168158
uses: ruby/setup-ruby@v1
169159
with:
170-
ruby-version: ${{ steps.versions.outputs.RUBY_VERSION }}
160+
ruby-version: ${{ inputs.version }}
171161
bundler-cache: true
172162

173163
- name: Install Ruby formatter
@@ -184,7 +174,7 @@ runs:
184174
if: ${{ inputs.language == 'csharp' }}
185175
uses: actions/setup-dotnet@v4
186176
with:
187-
dotnet-version: ${{ steps.versions.outputs.CSHARP_VERSION }}
177+
dotnet-version: ${{ inputs.version }}
188178

189179
# Swift deps
190180
- name: Install swift
@@ -195,7 +185,7 @@ runs:
195185
# uses: swift-actions/setup-swift@v2
196186
uses: redsun82/setup-swift@b2b6f77ab14f6a9b136b520dc53ec8eca27d2b99
197187
with:
198-
swift-version: ${{ steps.versions.outputs.SWIFT_VERSION }}
188+
swift-version: ${{ inputs.version }}
199189

200190
- name: Cache the build folder
201191
id: cache-swift-build
@@ -205,13 +195,13 @@ runs:
205195
path: |
206196
clients/algoliasearch-client-swift/.build
207197
tests/output/swift/.build
208-
key: swift-build-${{ steps.versions.outputs.SWIFT_VERSION }}-${{ runner.os }}
198+
key: swift-build-${{ inputs.version }}-${{ runner.os }}
209199

210200
- name: Set swiftformat version
211201
if: ${{ inputs.language == 'swift' }}
212202
id: swiftformat-version
213203
shell: bash
214-
run: echo "SWIFTFORMAT_VERSION=0.54.3" >> $GITHUB_OUTPUT
204+
run: echo "SWIFTFORMAT_VERSION=0.54.4" >> $GITHUB_OUTPUT
215205

216206
- name: Checkout swiftformat
217207
if: ${{ inputs.language == 'swift' }}

.github/workflows/check.yml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ jobs:
108108
outputs:
109109
RUN_SCRIPTS: ${{ steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 }}
110110

111+
RUN_WEBSITE: ${{ steps.diff.outputs.WEBSITE_CHANGED > 0 }}
112+
111113
SPECS_MATRIX: ${{ steps.spec-matrix.outputs.MATRIX }}
112114

113115
RUN_GEN: ${{ steps.gen-matrix.outputs.RUN_GEN }}
@@ -118,6 +120,7 @@ jobs:
118120
SWIFT_DATA: ${{ steps.gen-matrix.outputs.SWIFT_DATA }}
119121
RUN_MACOS_SWIFT_CTS: ${{ steps.gen-matrix.outputs.RUN_MACOS_SWIFT_CTS }}
120122

123+
KOTLIN_DATA: ${{ steps.gen-matrix.outputs.KOTLIN_DATA }}
121124
RUN_MACOS_KOTLIN_BUILD: ${{ steps.gen-matrix.outputs.RUN_MACOS_KOTLIN_BUILD }}
122125

123126
scripts:
@@ -183,6 +186,7 @@ jobs:
183186
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
184187
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
185188
MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }}
189+
name: client javascript${{ needs.setup.outputs.RUN_GEN_JAVASCRIPT == 'true' && format('@{0}', fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).version) || '' }}
186190
steps:
187191
- uses: actions/checkout@v4
188192

@@ -203,6 +207,7 @@ jobs:
203207
uses: ./.github/actions/setup
204208
with:
205209
language: javascript
210+
version: ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).version }}
206211

207212
- name: Generate clients
208213
run: yarn cli generate javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
@@ -223,6 +228,10 @@ jobs:
223228
if: ${{ startsWith(env.head_ref, 'chore/prepare-release-') }}
224229
run: cd clients/algoliasearch-client-javascript && yarn test:size
225230

231+
- name: Test JavaScript bundle and types
232+
if: ${{ startsWith(env.head_ref, 'chore/prepare-release-') }}
233+
run: cd clients/algoliasearch-client-javascript && yarn test:bundle
234+
226235
- name: Remove previous CTS output
227236
run: rm -rf ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).testsToDelete }}
228237

@@ -253,7 +262,7 @@ jobs:
253262
- name: Run e2e CTS
254263
id: cts-e2e
255264
continue-on-error: true
256-
if: ${{ !github.event.pull_request.head.repo.fork }}
265+
if: ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
257266
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
258267

259268
- name: Retry e2e CTS
@@ -295,6 +304,7 @@ jobs:
295304
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
296305
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
297306
MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }}
307+
name: client ${{ matrix.client.language }}@${{ matrix.client.version }}
298308
steps:
299309
- uses: actions/checkout@v4
300310

@@ -307,16 +317,17 @@ jobs:
307317
uses: ./.github/actions/setup
308318
with:
309319
language: ${{ matrix.client.language }}
320+
version: ${{ matrix.client.version }}
310321

311322
- name: Generate clients
312323
run: yarn cli generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}
313324

314325
- name: Update composer.lock
315-
if: ${{ matrix.client.language == 'php' && startsWith(env.head_ref, 'chore/renovateBaseBranch') }}
326+
if: ${{ matrix.client.language == 'php' && startsWith(env.head_ref, 'chore/renovateBaseBranch') && matrix.client.isMainVersion }}
316327
run: cd ${{ matrix.client.path }} && composer update
317328

318329
- name: Check for file duplicates in Swift
319-
if: ${{ matrix.client.language == 'swift' }}
330+
if: ${{ matrix.client.language == 'swift' && matrix.client.isMainVersion }}
320331
run: |
321332
set -eo pipefail
322333
cd clients/algoliasearch-client-swift
@@ -330,46 +341,55 @@ jobs:
330341
run: yarn cli build playground ${{ matrix.client.language }}
331342

332343
- name: Run Java 'algoliasearch' public API validation
333-
if: ${{ matrix.client.language == 'java' }}
344+
if: ${{ matrix.client.language == 'java' && matrix.client.isMainVersion && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-bc]') }}
334345
run: |
335346
cd ${{ matrix.client.path }}
336-
./gradlew :api:japicmp || exit 0
347+
exit_code=0
348+
./gradlew :api:japicmp || exit_code=$?
337349
338-
FILE=${{ matrix.client.path }}/api/build/reports/japi.txt
350+
FILE=./api/build/reports/japi.txt
339351
340352
if [[ -f "$FILE" ]]; then
341353
cat $FILE
342354
fi
343355
356+
exit $exit_code
357+
344358
- name: Remove previous CTS output
345359
run: rm -rf ${{ matrix.client.testsToDelete }} || true
346360

347361
- name: Generate CTS
348-
run: yarn cli cts generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}
362+
run: yarn cli cts generate ${{ matrix.client.language }} ${{ matrix.client.toRun }} --language-version ${{ matrix.client.version }}
349363

350364
- name: Run unit CTS
351365
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-e2e
352366

353367
- name: Run e2e CTS
354368
id: cts-e2e
355369
continue-on-error: true
356-
if: ${{ !github.event.pull_request.head.repo.fork }}
370+
if: ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
357371
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
358372

359373
- name: Retry e2e CTS
360374
if: ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }}
361375
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
362376

363377
- name: Run benchmarks
378+
if: ${{ matrix.client.isMainVersion }}
364379
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --benchmark --no-client --no-requests --no-e2e
365380

366381
- name: Generate code snippets for documentation
367382
run: yarn cli snippets ${{ matrix.client.language }} ${{ matrix.client.toRun }}
368383

384+
- name: Build the snippets to check validity
385+
run: yarn cli build snippets ${{ matrix.client.language }}
386+
369387
- name: Zip artifact before storing
388+
if: ${{ matrix.client.isMainVersion }}
370389
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/**"
371390

372391
- name: Store ${{ matrix.client.language }} clients
392+
if: ${{ matrix.client.isMainVersion }}
373393
uses: actions/upload-artifact@v4
374394
with:
375395
if-no-files-found: error
@@ -390,6 +410,7 @@ jobs:
390410
!contains(needs.*.result, 'failure')
391411
outputs:
392412
success: ${{ steps.setoutput.outputs.success }}
413+
name: client kotlin${{ needs.setup.outputs.RUN_MACOS_KOTLIN_BUILD == 'true' && format('@{0}', fromJSON(needs.setup.outputs.KOTLIN_DATA).version) || '' }} macos
393414
steps:
394415
- uses: actions/checkout@v4
395416

@@ -406,6 +427,12 @@ jobs:
406427
type: minimal
407428
language: kotlin
408429

430+
- name: remove previous build from linux
431+
run: |
432+
rm -rf clients/algoliasearch-client-kotlin/build || true
433+
rm -rf clients/algoliasearch-client-kotlin/.kotlin || true
434+
rm -rf clients/algoliasearch-client-kotlin/.gradle || true
435+
409436
- run: yarn cli build clients kotlin
410437

411438
- name: Set output
@@ -430,6 +457,7 @@ jobs:
430457
MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }}
431458
outputs:
432459
success: ${{ steps.setoutput.outputs.success }}
460+
name: client swift${{ needs.setup.outputs.RUN_MACOS_SWIFT_CTS == 'true' && format('@{0}', fromJSON(needs.setup.outputs.SWIFT_DATA).version) || '' }} macos
433461
steps:
434462
- uses: actions/checkout@v4
435463

@@ -445,8 +473,9 @@ jobs:
445473
with:
446474
type: minimal
447475
language: swift
476+
version: ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}
448477

449-
- run: yarn cli cts run swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }} -v
478+
- 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' || '' }}
450479

451480
- name: Set output
452481
id: setoutput
@@ -549,11 +578,11 @@ jobs:
549578
${{ steps.benchmark.outputs.BENCHMARK_SECTION }}
550579
551580
- name: Build website
552-
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }}
581+
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' && needs.setup.outputs.RUN_WEBSITE == 'true' }}
553582
run: yarn website:build
554583

555584
- name: Deploy documentation
556-
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }}
585+
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' && needs.setup.outputs.RUN_WEBSITE == 'true' }}
557586
uses: nwtgck/[email protected]
558587
with:
559588
publish-dir: 'website/build'

.github/workflows/issue.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Issue sync with Jira'
2+
on:
3+
issues:
4+
types: [opened]
5+
6+
permissions:
7+
issues: write
8+
contents: read
9+
10+
jobs:
11+
sync:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Create ticket
15+
uses: actions/github-script@v7
16+
with:
17+
script: |
18+
const action = context.payload.action;
19+
if (action !== 'opened') {
20+
return;
21+
}
22+
const title = context.payload.issue.title;
23+
const body = context.payload.issue.body;
24+
25+
const res = await fetch('https://algolia.atlassian.net/rest/api/2/issue', {
26+
method: 'POST',
27+
headers: {
28+
'Accept': 'application/json',
29+
'Content-Type': 'application/json',
30+
'Authorization': `Basic ${{ secrets.JIRA_TOKEN }}`
31+
},
32+
body: JSON.stringify({
33+
fields: {
34+
description: `Issue created by ${context.actor} at ${context.payload.issue.html_url} \n\n${body}`,
35+
issuetype: {
36+
id: '10001'
37+
},
38+
parent: {
39+
key: 'DI-2737'
40+
},
41+
project: {
42+
id: '10118'
43+
},
44+
summary: `[GH-ISSUE] ${title}`
45+
},
46+
update: {}
47+
})
48+
});
49+
50+
if (!res.ok) {
51+
throw new Error(`Failed to create ticket: ${res.statusText} (${res.status}) - ${await res.text()}`);
52+
}
53+
54+
const data = await res.json();
55+
console.log(`Created ticket: ${data.key}`);

0 commit comments

Comments
 (0)