Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ jobs:
type: minimal

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

- name: Build clients for macOS
id: build
Expand Down Expand Up @@ -501,7 +501,7 @@ jobs:
version: ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}

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

- name: Build clients
run: yarn cli build clients swift
Expand Down Expand Up @@ -545,7 +545,7 @@ jobs:
type: minimal

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

- name: Read benchmark results
id: benchmark
Expand Down
18 changes: 4 additions & 14 deletions scripts/ci/githubActions/createMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fsp from 'fs/promises';

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

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

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

// iterate over every generators to see what changed
for (const { language, client, output } of Object.values(GENERATORS)) {
const bundledSpec = client === 'algoliasearch' ? 'search' : client;

if (!commonDependenciesChanged) {
const key = `${language.toUpperCase()}_CLIENT_CHANGED`;
const languageDependencies = {
Expand All @@ -35,7 +33,7 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
const dependenciesChanged = await isBaseChanged(baseBranch, {
...languageDependencies,
output: [output],
specs: [`specs/${bundledSpec}`],
specs: ['specs'],
});

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

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

const testsRootFolder = `tests/output/${language}`;
const testsOutputBase = `${testsRootFolder}/${getTestOutputFolder(language)}`;
const toRun = matrix[language].toRun.join(' ');
const versionFile = toAbsolutePath(
language === 'javascript'
? '.nvmrc'
Expand All @@ -82,7 +79,6 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
const languageMatrix = {
language,
path: matrix[language].path,
toRun,
testsRootFolder,
// We delete tests to ensure the CI only run tests against what changed.
testsToDelete: `${testsOutputBase}/client ${testsOutputBase}/requests ${testsOutputBase}/e2e ${testsOutputBase}/benchmark`,
Expand Down Expand Up @@ -163,13 +159,7 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
}

function createSpecMatrix(): void {
setOutput(
'MATRIX',
JSON.stringify({
bundledPath: 'specs/bundled',
toRun: CLIENTS.join(' '),
}),
);
setOutput('MATRIX', JSON.stringify({ bundledPath: 'specs/bundled' }));
}

/**
Expand Down
4 changes: 0 additions & 4 deletions scripts/ci/githubActions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export type ClientMatrix = {
* Path to the file/folder being handled.
*/
path: string;
/**
* The list of clients to run in the CI.
*/
toRun: string;
/**
* The client language.
*/
Expand Down
11 changes: 1 addition & 10 deletions scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import clientsConfig from '../config/clients.config.json' with { type: 'json' };
import releaseConfig from '../config/release.config.json' with { type: 'json' };

import { Cache } from './cache.ts';
import { getClientsConfigField, getDockerImage } from './config.ts';
import { getDockerImage } from './config.ts';
import { generateOpenapitools } from './pre-gen/index.ts';
import { getGitAuthor } from './release/common.ts';
import { buildSpecs } from './specs/index.ts';
Expand Down Expand Up @@ -295,15 +295,6 @@ export async function setupAndGen(
await buildCustomGenerators();

for (const gen of generators) {
if (mode === 'guides') {
await run(
`rm -rf ${path.join('docs', mode, gen.language, getClientsConfigField(gen.language, ['snippets', 'outputFolder']))}`,
{
language: gen.language,
},
);
}

const spinner = createSpinner(`generating ${mode} for ${gen.key}`);
await fn(gen);
spinner.succeed();
Expand Down
Loading