Skip to content

Commit b154bda

Browse files
authored
chore(ci): always run all clients (#4563)
1 parent 2f6888c commit b154bda

File tree

4 files changed

+29
-52
lines changed

4 files changed

+29
-52
lines changed

.github/workflows/check.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ jobs:
161161
type: minimal
162162

163163
- name: Building specs
164-
run: yarn cli build specs ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).toRun }}
164+
run: yarn cli build specs
165165

166166
- name: Store bundled specs
167167
uses: actions/upload-artifact@v4
@@ -210,7 +210,7 @@ jobs:
210210
version: ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).version }}
211211

212212
- name: Generate clients
213-
run: yarn cli generate javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
213+
run: yarn cli generate javascript
214214

215215
- name: Update `yarn.lock` for JavaScript
216216
run: cd clients/algoliasearch-client-javascript && YARN_ENABLE_HARDENED_MODE=0 YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
@@ -219,13 +219,13 @@ jobs:
219219
run: cd clients/algoliasearch-client-javascript && yarn build
220220

221221
- name: Build the playground
222-
run: yarn cli build playground javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
222+
run: yarn cli build playground javascript
223223

224224
- name: Build the browser playground
225225
run: yarn workspace javascript-playground-browser build
226226

227227
- name: Run common and requester tests
228-
run: cd clients/algoliasearch-client-javascript && yarn test ${{ !contains(fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun, 'algoliasearch') && '--ignore algoliasearch' || '' }}
228+
run: cd clients/algoliasearch-client-javascript && yarn test
229229

230230
- name: Test JavaScript bundle size
231231
if: ${{ startsWith(github.head_ref, 'chore/prepare-release-') }}
@@ -239,7 +239,7 @@ jobs:
239239
run: rm -rf ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).testsToDelete }}
240240

241241
- name: Generate CTS
242-
run: yarn cli cts generate javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
242+
run: yarn cli cts generate javascript
243243

244244
# JavaScript test deps (needs to be cached because they are huge and inefficient)
245245
- name: Get yarn js test cache directory path
@@ -260,32 +260,32 @@ jobs:
260260
key: node-modules-tests-${{ hashFiles('tests/output/javascript/yarn.lock') }}
261261

262262
- name: Run unit CTS
263-
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-e2e
263+
run: yarn cli cts run javascript --no-e2e
264264

265265
- name: Run e2e CTS
266266
id: cts-e2e
267267
continue-on-error: true
268268
if: ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
269-
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
269+
run: yarn cli cts run javascript --no-client --no-requests
270270

271271
- name: Retry e2e CTS
272272
if: ${{ steps.cts-e2e.outcome == 'failure' }}
273-
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
273+
run: yarn cli cts run javascript --no-client --no-requests
274274

275275
- name: Run benchmarks
276-
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --benchmark --no-client --no-requests --no-e2e
276+
run: yarn cli cts run javascript --benchmark --no-client --no-requests --no-e2e
277277

278278
- name: Generate code snippets
279-
run: yarn cli snippets javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
279+
run: yarn cli snippets javascript
280280

281281
- name: Build the snippets to check validity
282-
run: yarn cli build snippets javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
282+
run: yarn cli build snippets javascript
283283

284284
- name: Generate code guides
285-
run: yarn cli guides javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
285+
run: yarn cli guides javascript
286286

287287
- name: Build the guides to check validity
288-
run: yarn cli build guides javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
288+
run: yarn cli build guides javascript
289289

290290
- name: Zip artifact before storing
291291
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/**"
@@ -334,7 +334,7 @@ jobs:
334334
version: ${{ matrix.client.version }}
335335

336336
- name: Generate clients
337-
run: yarn cli generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}
337+
run: yarn cli generate ${{ matrix.client.language }}
338338

339339
# no need to build the clients here, it will be done in the Run CTS step anyway.
340340

@@ -375,33 +375,33 @@ jobs:
375375
run: rm -rf ${{ matrix.client.testsToDelete }} || true
376376

377377
- name: Generate CTS
378-
run: yarn cli cts generate ${{ matrix.client.language }} ${{ matrix.client.toRun }} --language-version ${{ matrix.client.version }}
378+
run: yarn cli cts generate ${{ matrix.client.language }} --language-version ${{ matrix.client.version }}
379379

380380
- name: Run unit CTS
381-
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-e2e
381+
run: yarn cli cts run ${{ matrix.client.language }} --no-e2e
382382

383383
- name: Run e2e CTS
384384
id: cts-e2e
385385
continue-on-error: true
386386
if: ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
387-
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
387+
run: yarn cli cts run ${{ matrix.client.language }} --no-client --no-requests
388388

389389
- name: Retry e2e CTS
390390
if: ${{ steps.cts-e2e.outcome == 'failure' }}
391-
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
391+
run: yarn cli cts run ${{ matrix.client.language }} --no-client --no-requests
392392

393393
- name: Run benchmarks
394394
if: ${{ matrix.client.isMainVersion }}
395-
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --benchmark --no-client --no-requests --no-e2e
395+
run: yarn cli cts run ${{ matrix.client.language }} --benchmark --no-client --no-requests --no-e2e
396396

397397
- name: Generate code snippets
398-
run: yarn cli snippets ${{ matrix.client.language }} ${{ matrix.client.toRun }}
398+
run: yarn cli snippets ${{ matrix.client.language }}
399399

400400
- name: Build the snippets to check validity
401401
run: yarn cli build snippets ${{ matrix.client.language }}
402402

403403
- name: Generate code guides
404-
run: yarn cli guides ${{ matrix.client.language }} ${{ matrix.client.toRun }}
404+
run: yarn cli guides ${{ matrix.client.language }}
405405

406406
- name: Build the guides to check validity
407407
run: yarn cli build guides ${{ matrix.client.language }}
@@ -449,7 +449,7 @@ jobs:
449449
version: ${{ fromJSON(needs.setup.outputs.KOTLIN_DATA).version }}
450450

451451
- name: Generate clients
452-
run: yarn cli generate kotlin ${{ fromJSON(needs.setup.outputs.KOTLIN_DATA).toRun }}
452+
run: yarn cli generate kotlin
453453

454454
- name: Build clients for macOS
455455
id: build
@@ -501,7 +501,7 @@ jobs:
501501
version: ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}
502502

503503
- name: Generate clients
504-
run: yarn cli generate swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }}
504+
run: yarn cli generate swift
505505

506506
- name: Build clients
507507
run: yarn cli build clients swift
@@ -545,7 +545,7 @@ jobs:
545545
type: minimal
546546

547547
- name: Generate documentation specs with code snippets
548-
run: yarn cli build specs ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).toRun }} --docs
548+
run: yarn cli build specs --docs
549549

550550
- name: Read benchmark results
551551
id: benchmark

scripts/ci/githubActions/createMatrix.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fsp from 'fs/promises';
22

33
import { setOutput } from '@actions/core';
44

5-
import { CLIENTS, createClientName, exists, GENERATORS, LANGUAGES, toAbsolutePath } from '../../common.ts';
5+
import { createClientName, exists, GENERATORS, LANGUAGES, toAbsolutePath } from '../../common.ts';
66
import { getClientsConfigField, getLanguageFolder, getTestExtension, getTestOutputFolder } from '../../config.ts';
77

88
import type { ClientMatrix, CreateMatrix, ToRunMatrix } from './types.ts';
@@ -19,8 +19,6 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
1919

2020
// iterate over every generators to see what changed
2121
for (const { language, client, output } of Object.values(GENERATORS)) {
22-
const bundledSpec = client === 'algoliasearch' ? 'search' : client;
23-
2422
if (!commonDependenciesChanged) {
2523
const key = `${language.toUpperCase()}_CLIENT_CHANGED`;
2624
const languageDependencies = {
@@ -35,7 +33,7 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
3533
const dependenciesChanged = await isBaseChanged(baseBranch, {
3634
...languageDependencies,
3735
output: [output],
38-
specs: [`specs/${bundledSpec}`],
36+
specs: ['specs'],
3937
});
4038

4139
// No changes found, we don't put this job in the matrix
@@ -62,13 +60,12 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
6260

6361
// Now that we've built a map of what changed, we can create the matrix for the CI
6462
for (const language of LANGUAGES) {
65-
if (!matrix[language] || matrix[language].toRun.length === 0) {
63+
if (!matrix[language]) {
6664
continue;
6765
}
6866

6967
const testsRootFolder = `tests/output/${language}`;
7068
const testsOutputBase = `${testsRootFolder}/${getTestOutputFolder(language)}`;
71-
const toRun = matrix[language].toRun.join(' ');
7269
const versionFile = toAbsolutePath(
7370
language === 'javascript'
7471
? '.nvmrc'
@@ -82,7 +79,6 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
8279
const languageMatrix = {
8380
language,
8481
path: matrix[language].path,
85-
toRun,
8682
testsRootFolder,
8783
// We delete tests to ensure the CI only run tests against what changed.
8884
testsToDelete: `${testsOutputBase}/client ${testsOutputBase}/requests ${testsOutputBase}/e2e ${testsOutputBase}/benchmark`,
@@ -163,13 +159,7 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
163159
}
164160

165161
function createSpecMatrix(): void {
166-
setOutput(
167-
'MATRIX',
168-
JSON.stringify({
169-
bundledPath: 'specs/bundled',
170-
toRun: CLIENTS.join(' '),
171-
}),
172-
);
162+
setOutput('MATRIX', JSON.stringify({ bundledPath: 'specs/bundled' }));
173163
}
174164

175165
/**

scripts/ci/githubActions/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ export type ClientMatrix = {
1515
* Path to the file/folder being handled.
1616
*/
1717
path: string;
18-
/**
19-
* The list of clients to run in the CI.
20-
*/
21-
toRun: string;
2218
/**
2319
* The client language.
2420
*/

scripts/common.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import clientsConfig from '../config/clients.config.json' with { type: 'json' };
1010
import releaseConfig from '../config/release.config.json' with { type: 'json' };
1111

1212
import { Cache } from './cache.ts';
13-
import { getClientsConfigField, getDockerImage } from './config.ts';
13+
import { getDockerImage } from './config.ts';
1414
import { generateOpenapitools } from './pre-gen/index.ts';
1515
import { getGitAuthor } from './release/common.ts';
1616
import { buildSpecs } from './specs/index.ts';
@@ -295,15 +295,6 @@ export async function setupAndGen(
295295
await buildCustomGenerators();
296296

297297
for (const gen of generators) {
298-
if (mode === 'guides') {
299-
await run(
300-
`rm -rf ${path.join('docs', mode, gen.language, getClientsConfigField(gen.language, ['snippets', 'outputFolder']))}`,
301-
{
302-
language: gen.language,
303-
},
304-
);
305-
}
306-
307298
const spinner = createSpinner(`generating ${mode} for ${gen.key}`);
308299
await fn(gen);
309300
spinner.succeed();

0 commit comments

Comments
 (0)