Skip to content

Commit 5ba87a0

Browse files
authored
feat(specs): add abtesting specs and client (#76)
1 parent 9592e77 commit 5ba87a0

File tree

127 files changed

+2984
-994
lines changed

Some content is hidden

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

127 files changed

+2984
-994
lines changed

.eslintrc.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ module.exports = {
6363
'max-classes-per-file': 0,
6464
'no-continue': 0,
6565
'@typescript-eslint/prefer-enum-initializers': 0,
66-
// there's a conflict when declaring `type` and `namespaces`, even with `ignoreDeclarationMerge`
67-
'no-redeclare': 0,
68-
'@typescript-eslint/no-redeclare': 0,
6966

7067
'@typescript-eslint/no-unused-vars': 2,
7168
'unused-imports/no-unused-imports-ts': 2,

.github/actions/cache/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ runs:
4646
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-analytics/dist
4747
key: ${{ runner.os }}-js-client-analytics-${{ hashFiles('clients/algoliasearch-client-javascript/client-analytics/**') }}
4848

49+
- name: Restore built JavaScript abtesting client
50+
if: ${{ inputs.job == 'cts' }}
51+
uses: actions/cache@v2
52+
with:
53+
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-abtesting/dist
54+
key: ${{ runner.os }}-js-client-abtesting-${{ hashFiles('clients/algoliasearch-client-javascript/client-abtesting/**') }}
55+
4956
- name: Restore built JavaScript insights client
5057
if: ${{ inputs.job == 'cts' }}
5158
uses: actions/cache@v2

.github/actions/setup/action.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ runs:
3535
echo "::set-output name=PERSO_SPECS_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- specs/personalization | wc -l)"
3636
echo "::set-output name=INSIGHTS_SPECS_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- specs/insights | wc -l)"
3737
echo "::set-output name=ANALYTICS_SPECS_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- specs/analytics | wc -l)"
38-
echo "::set-output name=AB_SPECS_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- specs/abtesting | wc -l)"
38+
echo "::set-output name=ABTESTING_SPECS_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- specs/abtesting | wc -l)"
3939
4040
echo "::set-output name=TESTS_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- tests | wc -l)"
4141
@@ -47,6 +47,7 @@ runs:
4747
echo "::set-output name=JS_QUERY_SUGGESTIONS_CLIENT_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- clients/algoliasearch-client-javascript/client-query-suggestions | wc -l)"
4848
echo "::set-output name=JS_PERSO_CLIENT_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- clients/algoliasearch-client-javascript/client-personalization | wc -l)"
4949
echo "::set-output name=JS_ANALYTICS_CLIENT_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- clients/algoliasearch-client-javascript/client-analytics | wc -l)"
50+
echo "::set-output name=JS_ABTESTING_CLIENT_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- clients/algoliasearch-client-javascript/client-abtesting | wc -l)"
5051
echo "::set-output name=JS_INSIGHTS_CLIENT_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- clients/algoliasearch-client-javascript/client-insights | wc -l)"
5152
echo "::set-output name=JS_TEMPLATE_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- templates/javascript | wc -l)"
5253
@@ -73,9 +74,9 @@ outputs:
7374
RUN_SPECS_ANALYTICS:
7475
description: Determine if the `specs_analytics` job should run
7576
value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.ANALYTICS_SPECS_CHANGED > 0 }}
76-
RUN_SPECS_AB:
77-
description: Determine if the `specs_ab` job should run
78-
value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.AB_SPECS_CHANGED > 0 }}
77+
RUN_SPECS_ABTESTING:
78+
description: Determine if the `specs_abtesting` job should run
79+
value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.ABTESTING_SPECS_CHANGED > 0 }}
7980

8081
# js client variables
8182
RUN_JS_CLIENT_SEARCH:
@@ -93,6 +94,9 @@ outputs:
9394
RUN_JS_CLIENT_ANALYTICS:
9495
description: Determine if the `client_javascript_analytics` job should run
9596
value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.ANALYTICS_SPECS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.JS_ANALYTICS_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 }}
97+
RUN_JS_CLIENT_ABTESTING:
98+
description: Determine if the `client_javascript_abtesting` job should run
99+
value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.ABTESTING_SPECS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.JS_ABTESTING_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 }}
96100
RUN_JS_CLIENT_INSIGHTS:
97101
description: Determine if the `client_javascript_insights` job should run
98102
value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.INSIGHTS_SPECS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.JS_INSIGHTS_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 }}

.github/workflows/check.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ jobs:
3232
RUN_SPECS_PERSO: ${{ steps.setup.outputs.RUN_SPECS_PERSO }}
3333
RUN_SPECS_INSIGHTS: ${{ steps.setup.outputs.RUN_SPECS_INSIGHTS }}
3434
RUN_SPECS_ANALYTICS: ${{ steps.setup.outputs.RUN_SPECS_ANALYTICS }}
35-
RUN_SPECS_AB: ${{ steps.setup.outputs.RUN_SPECS_AB }}
35+
RUN_SPECS_ABTESTING: ${{ steps.setup.outputs.RUN_SPECS_ABTESTING }}
3636

3737
RUN_JS_CLIENT_SEARCH: ${{ steps.setup.outputs.RUN_JS_CLIENT_SEARCH }}
3838
RUN_JS_CLIENT_RECOMMEND: ${{ steps.setup.outputs.RUN_JS_CLIENT_RECOMMEND }}
3939
RUN_JS_CLIENT_QUERY_SUGGESTIONS: ${{ steps.setup.outputs.RUN_JS_CLIENT_QUERY_SUGGESTIONS }}
4040
RUN_JS_CLIENT_PERSO: ${{ steps.setup.outputs.RUN_JS_CLIENT_PERSO }}
4141
RUN_JS_CLIENT_ANALYTICS: ${{ steps.setup.outputs.RUN_JS_CLIENT_ANALYTICS }}
42+
RUN_JS_CLIENT_ABTESTING: ${{ steps.setup.outputs.RUN_JS_CLIENT_ABTESTING }}
4243
RUN_JS_CLIENT_INSIGHTS: ${{ steps.setup.outputs.RUN_JS_CLIENT_INSIGHTS }}
4344

4445
RUN_JAVA_CLIENT: ${{ steps.setup.outputs.RUN_JAVA_CLIENT }}
@@ -125,6 +126,22 @@ jobs:
125126
- name: Lint analytics specs
126127
run: yarn eslint --ext=yml specs/analytics
127128

129+
specs_abtesting:
130+
runs-on: ubuntu-20.04
131+
needs: setup
132+
if: ${{ always() && needs.setup.outputs.RUN_SPECS_ABTESTING == 'true' }}
133+
steps:
134+
- uses: actions/checkout@v2
135+
136+
- name: Restore cache
137+
uses: ./.github/actions/cache
138+
139+
- name: Checking abtesting specs
140+
run: yarn build:specs abtesting
141+
142+
- name: Lint abtesting specs
143+
run: yarn eslint --ext=yml specs/abtesting
144+
128145
specs_insights:
129146
runs-on: ubuntu-20.04
130147
needs: setup
@@ -266,6 +283,31 @@ jobs:
266283
if: steps.cache.outputs.cache-hit != 'true'
267284
run: yarn build:clients javascript analytics
268285

286+
client_javascript_abtesting:
287+
runs-on: ubuntu-20.04
288+
needs: [specs_abtesting]
289+
if: ${{ always() && needs.setup.outputs.RUN_JS_CLIENT_ABTESTING == 'true' }}
290+
steps:
291+
- uses: actions/checkout@v2
292+
293+
- name: Restore cache
294+
uses: ./.github/actions/cache
295+
296+
- name: Cache abtesting client
297+
id: cache
298+
uses: actions/cache@v2
299+
with:
300+
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-abtesting/dist
301+
key: ${{ runner.os }}-js-client-abtesting-${{ hashFiles('clients/algoliasearch-client-javascript/client-abtesting/**') }}
302+
303+
- name: Generate abtesting client
304+
if: steps.cache.outputs.cache-hit != 'true'
305+
run: yarn generate javascript abtesting
306+
307+
- name: Build abtesting client
308+
if: steps.cache.outputs.cache-hit != 'true'
309+
run: yarn build:clients javascript abtesting
310+
269311
client_javascript_insights:
270312
runs-on: ubuntu-20.04
271313
needs: [specs_insights]
@@ -326,6 +368,7 @@ jobs:
326368
- client_javascript_query_suggestions
327369
- client_javascript_perso
328370
- client_javascript_analytics
371+
- client_javascript_abtesting
329372
- client_javascript_insights
330373
- client_java_search
331374

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,19 @@ The clients can be tested inside the [`playground`](./playground) folder
101101
### Usage
102102

103103
```bash
104-
yarn docker playground:<language>:<client>
104+
yarn docker playground <language> <client>
105105
```
106106

107107
### JavaScript
108108

109109
```bash
110-
yarn docker playground:js:search
110+
yarn docker playground javascript search
111111
```
112112

113113
### Java
114114

115115
```bash
116-
yarn docker playground:java:search
116+
yarn docker playground java search
117117
```
118118

119119
# Troubleshooting

clients/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ This folder hosts the generated clients and their utils.
44

55
## Generated clients
66

7+
### Java
8+
9+
- [algoliasearch-client-java-2](./algoliasearch-client-java-2/): The Algolia search client.
10+
711
### JavaScript
812

9-
- [algoliasearch](./algoliasearch-client-javascript/algoliasearch/): The Algolia search client.
13+
- [@algolia/client-abtesting](./algoliasearch-client-javascript/client-abtesting/): The Algolia AB testing client.
14+
- [@algolia/client-analytics](./algoliasearch-client-javascript/client-analytics/): The Algolia analytics client.
15+
- [@algolia/client-insights](./algoliasearch-client-javascript/client-insights/): The Algolia insights client.
16+
- [@algolia/client-personalization](./algoliasearch-client-javascript/client-personalization/): The Algolia personalization client.
17+
- [@algolia/client-query-suggestions](./algoliasearch-client-javascript/client-query-suggestions/): The Algolia query suggestions client.
18+
- [@algolia/client-search](./algoliasearch-client-javascript/client-search/): The Algolia search client.
1019
- [@algolia/recommend](./algoliasearch-client-javascript/recommend/): The Algolia recommend client.
1120

12-
## Utils
21+
#### Utils
1322

1423
- [JavaScript](./algoliasearch-client-javascript/utils/): The JavaScript clients utils.

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public BatchResponse taskID(Integer taskID) {
2020
}
2121

2222
/**
23-
* taskID of the indexing task to wait for.
23+
* taskID of the task to wait for.
2424
*
2525
* @return taskID
2626
*/

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeletedAtResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public DeletedAtResponse taskID(Integer taskID) {
1919
}
2020

2121
/**
22-
* taskID of the indexing task to wait for.
22+
* taskID of the task to wait for.
2323
*
2424
* @return taskID
2525
*/

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public SaveObjectResponse taskID(Integer taskID) {
4040
}
4141

4242
/**
43-
* taskID of the indexing task to wait for.
43+
* taskID of the task to wait for.
4444
*
4545
* @return taskID
4646
*/

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public SaveSynonymResponse taskID(Integer taskID) {
2222
}
2323

2424
/**
25-
* taskID of the indexing task to wait for.
25+
* taskID of the task to wait for.
2626
*
2727
* @return taskID
2828
*/

0 commit comments

Comments
 (0)