Skip to content

Commit 82f7bca

Browse files
authored
Merge branch 'main' into feat/add-chopper-requester-package
2 parents 5a6598d + fbfb731 commit 82f7bca

File tree

6 files changed

+112
-80
lines changed

6 files changed

+112
-80
lines changed

.github/workflows/check.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
- uses: marocchino/sticky-pull-request-comment@v2
3131
with:
3232
message: |
33-
### 🔨 The generated code will be pushed at the end of the CI.
33+
### 🪓 The generated code will be pushed at the end of the CI.
3434
35-
Action triggered by commit `${{ github.sha}}`.
35+
Action triggered by commit [`${{ github.sha }}`](${{ github.event.pull_request.base.repo.html_url }}/commit/${{ github.sha }}).
3636
3737
_Please do not push any generated code to this pull request._
3838
@@ -472,14 +472,25 @@ jobs:
472472

473473
- name: update generation comment
474474
uses: marocchino/sticky-pull-request-comment@v2
475+
if: ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT == '' }}
476+
with:
477+
message: |
478+
### No code generated
479+
480+
_If you believe code should've been generated, please, [report the issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=Bug_report.yml&title=%5Bbug%5D%3A+)._
481+
482+
- name: update generation comment
483+
uses: marocchino/sticky-pull-request-comment@v2
484+
if: ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT != '' }}
475485
with:
476486
message: |
477487
### ✔️ Code generated!
478488
479489
| Name | Link |
480490
|---------------------------------|------------------------|
481-
| 🔨 Triggered by | [`${{ github.sha }}`](${{ github.pull_request.html_url }}/commits/${{ github.sha }}) |
482-
| 🌲 Generated branch | [`generated/${{ github.head_ref }}`](${{ github.pull_request.base.repo.html_url }}/tree/generated/${{ github.head_ref }}) |
491+
| 🪓 Triggered by | [`${{ github.sha }}`](${{ github.event.pull_request.base.repo.html_url }}/commit/${{ github.sha }}) |
492+
| 🍃 Generated commit | [`${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT }}`](${{ github.event.pull_request.base.repo.html_url }}/commit/${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT }}) |
493+
| 🌲 Generated branch | [`generated/${{ github.head_ref }}`](${{ github.event.pull_request.base.repo.html_url }}/tree/generated/${{ github.head_ref }}) |
483494
484495
- name: Spread generation to each repository
485496
id: spreadGeneration

clients/algoliasearch-client-ruby/.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ jobs:
2525
bundler-cache: true
2626

2727
- uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31
28+
with:
29+
await-release: false

scripts/ci/codegen/pushGeneratedCode.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/* eslint-disable no-console */
2+
import { setOutput } from '@actions/core';
3+
24
import { configureGitHubAuthor, ensureGitHubToken, MAIN_BRANCH, run } from '../../common.js';
35
import { getNbGitDiff } from '../utils.js';
46

@@ -76,6 +78,8 @@ Co-authored-by: %an <%ae>
7678
await run('git add .');
7779
await run(`git commit -m "${message}"`);
7880
await run(`git push origin ${branchToPush}`);
81+
82+
setOutput('GENERATED_COMMIT', await run('git rev-parse HEAD'));
7983
}
8084

8185
if (import.meta.url.endsWith(process.argv[1])) {

scripts/ci/githubActions/createMatrix.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-case-declarations */
2-
import * as core from '@actions/core';
2+
import { setOutput } from '@actions/core';
33

44
import { CLIENTS, createClientName, GENERATORS, LANGUAGES } from '../../common.js';
55
import { getLanguageFolder, getTestExtension, getTestOutputFolder } from '../../config.js';
@@ -139,31 +139,31 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
139139
// If there are updates for the Swift client, we allow ourselves to run the CTS on macOS
140140
const swiftData = clientMatrix.client.find((c) => c.language === 'swift');
141141
if (swiftData) {
142-
core.setOutput('SWIFT_DATA', JSON.stringify(swiftData));
143-
core.setOutput('RUN_MACOS_SWIFT_CTS', true);
142+
setOutput('SWIFT_DATA', JSON.stringify(swiftData));
143+
setOutput('RUN_MACOS_SWIFT_CTS', true);
144144
}
145145

146146
// If there are updates for the Kotlin client, we allow ourselves to run the build step on macOS
147147
const runKotlin = clientMatrix.client.find((c) => c.language === 'kotlin');
148148
if (runKotlin) {
149-
core.setOutput('RUN_MACOS_KOTLIN_BUILD', true);
149+
setOutput('RUN_MACOS_KOTLIN_BUILD', true);
150150
}
151151

152152
const javascriptData = clientMatrix.client.find((c) => c.language === 'javascript');
153153
if (javascriptData) {
154-
core.setOutput('JAVASCRIPT_DATA', JSON.stringify(javascriptData));
155-
core.setOutput('RUN_GEN_JAVASCRIPT', true);
154+
setOutput('JAVASCRIPT_DATA', JSON.stringify(javascriptData));
155+
setOutput('RUN_GEN_JAVASCRIPT', true);
156156
clientMatrix.client = clientMatrix.client.filter((c) => c.language !== 'javascript');
157157
}
158158

159159
const shouldRun = clientMatrix.client.length > 0;
160160

161-
core.setOutput('RUN_GEN', shouldRun);
162-
core.setOutput('GEN_MATRIX', JSON.stringify(shouldRun ? clientMatrix : EMPTY_MATRIX));
161+
setOutput('RUN_GEN', shouldRun);
162+
setOutput('GEN_MATRIX', JSON.stringify(shouldRun ? clientMatrix : EMPTY_MATRIX));
163163
}
164164

165165
function createSpecMatrix(): void {
166-
core.setOutput(
166+
setOutput(
167167
'MATRIX',
168168
JSON.stringify({
169169
bundledPath: 'specs/bundled',

scripts/release/createReleasePR.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export async function decideReleaseStrategy({
321321
*
322322
* Gracefully exits if there is none.
323323
*/
324-
async function getCommits(): Promise<{
324+
async function getCommits(force?: boolean): Promise<{
325325
validCommits: PassedCommit[];
326326
skippedCommits: string;
327327
}> {
@@ -354,7 +354,7 @@ async function getCommits(): Promise<{
354354
validCommits.push(commit);
355355
}
356356

357-
if (validCommits.length === 0) {
357+
if (!force && validCommits.length === 0) {
358358
console.log(
359359
chalk.black.bgYellow('[INFO]'),
360360
`Skipping release because no valid commit has been added since \`released\` tag.`,
@@ -505,7 +505,7 @@ export async function createReleasePR({
505505
}
506506

507507
console.log('Searching for commits since last release...');
508-
const { validCommits, skippedCommits } = await getCommits();
508+
const { validCommits, skippedCommits } = await getCommits(releaseType !== undefined);
509509

510510
const versions = await decideReleaseStrategy({
511511
versions: readVersions(),

website/docs/contributing/testing/common-test-suite.md

Lines changed: 79 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -33,71 +33,86 @@ The list of `queryParameters` must match exactly the actual value, the CTS has t
3333
> See the [browse test file for the search client](https://github.com/algolia/api-clients-automation/blob/main/tests/CTS/requests/search/browse.json)
3434
3535
```json
36-
[
37-
{
38-
"testName": "The name of the test (e.g. 'searches to testIndex with query parameters')",
39-
// The parameters of you'd like to pass to the method
40-
"parameters": {
41-
"indexName": "testIndex",
42-
"searchParams": {
43-
"offset": 42,
44-
"limit": 21,
45-
"query": "the string to search"
46-
},
47-
"facets": ["*"]
48-
},
49-
// Additional options sent with your method
50-
"requestOptions": {
51-
// Merged with transporter query parameters
52-
"queryParameters": {
53-
"anOtherParam": true
54-
},
55-
// Merged with transporter headers
56-
"headers": {
57-
"x-header": "test"
58-
}
59-
},
60-
// The payload of the request
61-
"request": {
62-
"path": "/1/indexes/testIndex/query",
63-
"method": "POST",
64-
"body": { "query": "the string to search" },
65-
"queryParameters": {
66-
"otherParam": "22",
67-
"anOtherParam": "true"
68-
},
69-
"headers": {
70-
"x-header": "test"
71-
}
72-
},
73-
// The expected response - useful for e2e assertions
74-
"response": {
75-
"statusCode": 200,
76-
// This doesn't need to be the full response since we support partial assertions
77-
"body": {
78-
"results": [
79-
{
80-
"hits": [],
81-
"page": 0,
82-
"nbHits": 0,
83-
"nbPages": 0,
84-
"hitsPerPage": 20,
85-
"exhaustiveNbHits": true,
86-
"exhaustiveTypo": true,
87-
"exhaustive": {
88-
"nbHits": true,
89-
"typo": true
36+
{
37+
"$schema": "http://json-schema.org/draft-04/schema#",
38+
"type": "object",
39+
"properties": {
40+
"testName": {
41+
"type": "string",
42+
"description": "The name of the test, defaults to the name of the `operation` (file name). The testName is also used for the documentation snippets as a key to access it inside the snippet JSON object: with a testName equal to `foo` on the `operationIndex` of the `search` client, you can access it from the `search.operationIndex.foo` key."
43+
},
44+
"isSnippet": {
45+
"type": "boolean",
46+
"description": "Whether this test case should also be a documentation code snippet."
47+
},
48+
"parameters": {
49+
"type": "object",
50+
"description": "A free form object that must correspond to the parameters that the method expects."
51+
},
52+
"requestOptions": {
53+
"type": "object",
54+
"description": "The requests options of an Algolia client to send with the current test case.",
55+
"properties": {
56+
"queryParameters": {
57+
"type": "object",
58+
"description": "The extra query parameters to send with your initial request."
59+
},
60+
"headers": {
61+
"type": "object",
62+
"description": "The extra headers to send with your initial request."
63+
}
64+
}
65+
},
66+
"request": {
67+
"type": "object",
68+
"description": "The expected request to be sent by the client.",
69+
"properties": {
70+
"path": {
71+
"type": "string",
72+
"description": "The path of the API client request, e.g. /1/foo/bar."
73+
},
74+
"method": {
75+
"type": "string",
76+
"description": "The HTTP method used to contact the path, e.g. GET."
77+
},
78+
"body": {
79+
"type": "object",
80+
"description": "A free form object that contains the expected payload to be sent for the current test case."
81+
},
82+
"queryParameters": {
83+
"type": "object",
84+
"description": "A free form object that contains the expected query parameters to be sent for the current test case."
85+
},
86+
"headers": {
87+
"type": "object",
88+
"description": "A free form object that contains the expected headers to be sent for the current test case."
89+
}
9090
},
91-
"query": "",
92-
"params": "",
93-
"index": "cts_e2e_search_empty_index",
94-
"renderingContent": {}
95-
}
96-
]
97-
}
98-
}
99-
}
100-
]
91+
"required": [
92+
"path",
93+
"method"
94+
]
95+
},
96+
"response": {
97+
"type": "object",
98+
"description": "The expected response to be returned by the client. Specificying this field indicates an e2e test will be performed, nothing is mocked.",
99+
"properties": {
100+
"statusCode": {
101+
"type": "integer",
102+
"description": "The status code of the response."
103+
},
104+
"body": {
105+
"type": "object",
106+
"description": "A free form object that contains the expected response to be received for the current test case."
107+
}
108+
}
109+
}
110+
},
111+
"required": [
112+
"parameters",
113+
"request"
114+
]
115+
}
101116
```
102117

103118
#### e2e

0 commit comments

Comments
 (0)