Skip to content

Commit 2207ebe

Browse files
committed
Merge branch 'main' into feat/helper-tests
2 parents 608a212 + 072c38b commit 2207ebe

File tree

6,712 files changed

+333449
-203212
lines changed

Some content is hidden

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

6,712 files changed

+333449
-203212
lines changed

.eslintrc.cjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
'**/target',
1010
'**/.yarn',
1111
'website/specs',
12-
'**/project.packagespec.json'
12+
'**/project.packagespec.json',
1313
],
1414

1515
overrides: [
@@ -52,6 +52,7 @@ module.exports = {
5252
files: ['specs/**/*.yml'],
5353
rules: {
5454
'automation-custom/end-with-dot': 'error',
55+
'automation-custom/no-final-dot': 'error',
5556
'automation-custom/single-quote-ref': 'error',
5657
},
5758
overrides: [
@@ -149,7 +150,7 @@ module.exports = {
149150

150151
parserOptions: {
151152
tsconfigRootDir: __dirname,
152-
project: './clients/algoliasearch-client-javascript/tsconfig.json'
153+
project: './clients/algoliasearch-client-javascript/tsconfig.json',
153154
},
154155

155156
rules: {
@@ -183,6 +184,6 @@ module.exports = {
183184
rules: {
184185
'automation-custom/no-new-line': 'error',
185186
},
186-
}
187+
},
187188
],
188189
};

.github/.cache_version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/actions/setup/action.yml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,17 @@ inputs:
1313
runs:
1414
using: composite
1515
steps:
16-
- name: Read current GitHub Actions cache version
17-
shell: bash
18-
run: |
19-
echo "CACHE_VERSION=$(< .github/.cache_version)" >> $GITHUB_ENV
20-
2116
# Java for code generation
2217
- name: Install Java
2318
if: inputs.type != 'minimal'
24-
uses: actions/setup-java@v4
19+
uses: actions/setup-java@v4.2.1
2520
with:
2621
distribution: zulu
2722
java-version-file: config/.java-version
2823

2924
- name: Validate gradle wrapper
3025
if: inputs.type != 'minimal'
31-
uses: gradle/wrapper-validation-action@v2
26+
uses: gradle/wrapper-validation-action@v3
3227

3328
- name: Setup gradle
3429
if: inputs.type != 'minimal'
@@ -39,7 +34,7 @@ runs:
3934
- name: Download Java formatter
4035
if: inputs.type != 'minimal'
4136
shell: bash
42-
run: curl --retry 3 -L "https://github.com/google/google-java-format/releases/download/v1.20.0/google-java-format-1.20.0-all-deps.jar" > /tmp/java-formatter.jar
37+
run: curl --retry 3 -L "https://github.com/google/google-java-format/releases/download/v1.22.0/google-java-format-1.22.0-all-deps.jar" > /tmp/java-formatter.jar
4338

4439
# JavaScript for monorepo and tooling
4540
- name: Install Node
@@ -57,8 +52,7 @@ runs:
5752
uses: actions/cache@v4
5853
with:
5954
path: ${{ steps.yarn-cache-dir.outputs.dir || '.yarn/cache' }}
60-
# let yarn handle the cache hash
61-
key: yarn-cache-${{ env.CACHE_VERSION }}
55+
key: yarn-cache-monorepo-${{ hashFiles('yarn.lock') }}
6256

6357
- name: Install JavaScript dependencies
6458
shell: bash
@@ -93,15 +87,14 @@ runs:
9387
uses: actions/cache@v4
9488
with:
9589
path: ${{ steps.yarn-cache-dir-client.outputs.dir || 'clients/algoliasearch-client-javascript/.yarn/cache' }}
96-
# let yarn handle the cache hash
97-
key: yarn-cache-client-${{ env.CACHE_VERSION }}
90+
key: yarn-cache-clients-${{ hashFiles('clients/algoliasearch-client-javascript/yarn.lock') }}
9891

9992
- name: Cache js-client node modules
10093
if: ${{ inputs.language == 'javascript' }}
10194
uses: actions/cache@v4
10295
with:
10396
path: clients/algoliasearch-client-javascript/node_modules
104-
key: node-modules-client-${{ env.CACHE_VERSION }}-${{ hashFiles('clients/algoliasearch-client-javascript/yarn.lock') }}
97+
key: node-modules-clients-${{ hashFiles('clients/algoliasearch-client-javascript/yarn.lock') }}
10598

10699
- name: Install JavaScript client dependencies
107100
if: ${{ inputs.language == 'javascript' }}
@@ -135,7 +128,7 @@ runs:
135128
if: ${{ inputs.language == 'go' }}
136129
shell: bash
137130
run: |
138-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
131+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0
139132
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
140133
go install golang.org/x/tools/cmd/goimports@latest
141134
@@ -144,15 +137,15 @@ runs:
144137
uses: actions/cache@v4
145138
with:
146139
path: ~/.cache/golangci-lint
147-
key: golangci-lint-${{ env.CACHE_VERSION }}-${{ steps.versions.outputs.GO_VERSION }}-${{ hashFiles('clients/algoliasearch-client-go/go.sum') }}
140+
key: golangci-lint-${{ steps.versions.outputs.GO_VERSION }}-${{ hashFiles('clients/algoliasearch-client-go/go.sum') }}
148141

149142
# Kotlin
150143
- name: Cache spotless
151144
if: ${{ inputs.language == 'kotlin' }}
152145
uses: actions/cache@v4
153146
with:
154147
path: clients/algoliasearch-client-kotlin/client/build/spotless
155-
key: spotless-${{ env.CACHE_VERSION }}-${{ hashFiles('clients/algoliasearch-client-kotlin/build.gradle.kts') }}
148+
key: spotless-${{ hashFiles('clients/algoliasearch-client-kotlin/build.gradle.kts') }}
156149

157150
# Dart
158151
- name: Install dart
@@ -201,7 +194,11 @@ runs:
201194
# Swift deps
202195
- name: Install swift
203196
if: ${{ inputs.language == 'swift' }}
204-
uses: swift-actions/setup-swift@v1
197+
# WORKAROUND for: https://github.com/swift-actions/setup-swift/issues/591
198+
# BY GitHub Staff developer: redsun82
199+
# IN pull request: https://github.com/github/codeql/pull/16153
200+
# uses: swift-actions/setup-swift@v2
201+
uses: redsun82/setup-swift@b2b6f77ab14f6a9b136b520dc53ec8eca27d2b99
205202
with:
206203
swift-version: ${{ steps.versions.outputs.SWIFT_VERSION }}
207204

@@ -219,7 +216,7 @@ runs:
219216
uses: actions/cache@v4
220217
with:
221218
path: swiftformat/.build
222-
key: swiftformat-build-0.53.0-${{ runner.os }}-${{ env.CACHE_VERSION }}
219+
key: swiftformat-build-0.53.0-${{ runner.os }}
223220

224221
- name: Build swiftformat
225222
if: ${{ inputs.language == 'swift' && steps.cache-swiftformat.outputs.cache-hit != 'true' }}

.github/workflows/check.yml

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
diff=$(git status --porcelain ./scripts/ci/actions | wc -l)
6363
6464
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\`"
6666
fi
6767
6868
exit $diff
@@ -96,6 +96,9 @@ jobs:
9696
JAVASCRIPT_DATA: ${{ steps.gen-matrix.outputs.JAVASCRIPT_DATA }}
9797
RUN_GEN_JAVASCRIPT: ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT }}
9898

99+
SWIFT_DATA: ${{ steps.gen-matrix.outputs.SWIFT_DATA }}
100+
RUN_MACOS_SWIFT_CTS: ${{ steps.gen-matrix.outputs.RUN_MACOS_SWIFT_CTS }}
101+
99102
scripts:
100103
runs-on: ubuntu-22.04
101104
timeout-minutes: 10
@@ -125,21 +128,12 @@ jobs:
125128
steps:
126129
- uses: actions/checkout@v4
127130

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-
135131
- name: Setup
136-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
137132
uses: ./.github/actions/setup
138133
with:
139134
type: minimal
140135

141136
- name: Building specs
142-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
143137
run: yarn cli build specs ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).toRun }}
144138

145139
- name: Store bundled specs
@@ -170,7 +164,7 @@ jobs:
170164
uses: actions/cache@v4
171165
with:
172166
key: |
173-
${{ matrix.client }}-${{ env.CACHE_VERSION }}-${{ hashFiles(
167+
${{ matrix.client }}-${{ hashFiles(
174168
format('clients/algoliasearch-client-javascript/packages/{0}/**', matrix.client),
175169
'clients/algoliasearch-client-javascript/yarn.lock'
176170
)}}
@@ -215,22 +209,13 @@ jobs:
215209
steps:
216210
- uses: actions/checkout@v4
217211

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-
226212
- name: Download specs artifacts
227-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
228213
uses: ./scripts/ci/actions/restore-artifacts
229214
with:
230215
type: specs
231216

232217
- 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-') }}
234219
run: |
235220
cd clients/algoliasearch-client-javascript/packages
236221
ls | grep -v -E "(client-common|requester-*|algoliasearch)" | xargs rm -rf
@@ -243,22 +228,20 @@ jobs:
243228
language: javascript
244229

245230
- name: Generate clients
246-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
247231
run: yarn cli generate javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
248232

249233
- name: Update `yarn.lock` for JavaScript
250234
run: cd clients/algoliasearch-client-javascript && YARN_ENABLE_HARDENED_MODE=0 YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
251235

252236
- name: Build clients
253-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
254237
run: ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).buildCommand }}
255238

256239
- 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-') }}
258241
run: cd clients/algoliasearch-client-javascript && yarn test:size
259242

260243
- 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') }}
262245
run: cd clients/algoliasearch-client-javascript && yarn workspace algoliasearch test
263246

264247
- name: Remove previous CTS output
@@ -277,14 +260,13 @@ jobs:
277260
uses: actions/cache@v4
278261
with:
279262
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') }}
282264

283265
- name: Cache js tests node modules
284266
uses: actions/cache@v4
285267
with:
286268
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') }}
288270

289271
- name: Run CTS
290272
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
@@ -304,7 +286,7 @@ jobs:
304286

305287
client_gen:
306288
timeout-minutes: 20
307-
runs-on: 'ubuntu-22.04'
289+
runs-on: ubuntu-22.04
308290
needs:
309291
- setup
310292
- specs
@@ -324,16 +306,7 @@ jobs:
324306
steps:
325307
- uses: actions/checkout@v4
326308

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-
335309
- name: Download specs artifacts
336-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
337310
uses: ./scripts/ci/actions/restore-artifacts
338311
with:
339312
type: specs
@@ -344,19 +317,25 @@ jobs:
344317
language: ${{ matrix.client.language }}
345318

346319
- name: Generate clients
347-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
348320
run: yarn cli generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}
349321

350322
- 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') }}
352324
run: cd ${{ matrix.client.path }} && composer update
353325

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+
354334
- name: Build clients
355-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
356335
run: ${{ matrix.client.buildCommand }}
357336

358337
- 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' }}
360339
run: |
361340
cd ${{ matrix.client.path }}
362341
./gradlew :api:japicmp || exit 0
@@ -389,15 +368,53 @@ jobs:
389368
name: clients-${{matrix.client.language }}
390369
path: clients-${{matrix.client.language }}.zip
391370

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+
392407
codegen:
393408
runs-on: ubuntu-22.04
394409
timeout-minutes: 15
395410
needs:
396411
- setup
397412
- client_gen
398413
- client_gen_javascript
414+
- swift_cts_macos
399415
if: |
400416
always() &&
417+
(needs.swift_cts_macos.result == 'success' || needs.swift_cts_macos.result == 'skipped') &&
401418
!contains(needs.*.result, 'cancelled') &&
402419
!contains(needs.*.result, 'failure')
403420
outputs:
@@ -410,7 +427,6 @@ jobs:
410427
token: ${{ secrets.ALGOLIA_BOT_TOKEN }}
411428

412429
- name: Download all artifacts
413-
if: ${{ needs.setup.outputs.RUN_GEN == 'true' || needs.setup.outputs.RUN_GEN_JAVASCRIPT == 'true' }}
414430
uses: ./scripts/ci/actions/restore-artifacts
415431
with:
416432
type: all
@@ -421,14 +437,13 @@ jobs:
421437
type: minimal
422438

423439
- name: Generate documentation specs with code snippets
424-
if: ${{ needs.setup.outputs.RUN_GEN == 'true' || needs.setup.outputs.RUN_GEN_JAVASCRIPT == 'true' }}
425440
run: yarn cli build specs ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).toRun }} --docs
426441

427442
- name: Build website
428443
run: yarn website:build
429444

430445
- name: Deploy documentation
431-
uses: nwtgck/actions-netlify@v2.1
446+
uses: nwtgck/actions-netlify@v3.0
432447
with:
433448
publish-dir: 'website/build'
434449
production-branch: main

0 commit comments

Comments
 (0)