96
96
runs-on : ubuntu-20.04
97
97
timeout-minutes : 10
98
98
needs : setup
99
- strategy :
99
+ env :
100
100
matrix : ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX) }}
101
101
steps :
102
102
- uses : actions/checkout@v2
@@ -105,8 +105,8 @@ jobs:
105
105
id : cache
106
106
uses : actions/cache@v3
107
107
with :
108
- key : ${{ matrix.client. cacheKey }}
109
- path : ${{ matrix.client. bundledPath }}
108
+ key : ${{ matrix.cacheKey }}
109
+ path : ${{ matrix.bundledPath }}
110
110
111
111
- name : Setup
112
112
if : ${{ steps.cache.outputs.cache-hit != 'true' }}
@@ -116,14 +116,14 @@ jobs:
116
116
117
117
- name : Building specs
118
118
if : ${{ steps.cache.outputs.cache-hit != 'true' }}
119
- run : yarn cli build specs ${{ matrix.client. toRun }}
119
+ run : yarn cli build specs ${{ matrix.toRun }}
120
120
121
121
- name : Store bundled specs
122
122
uses : actions/upload-artifact@v3
123
123
with :
124
124
if-no-files-found : error
125
125
name : specs
126
- path : ${{ matrix.client. bundledPath }}
126
+ path : ${{ matrix.bundledPath }}
127
127
128
128
client_javascript_utils :
129
129
timeout-minutes : 10
@@ -155,14 +155,15 @@ jobs:
155
155
uses : ./.github/actions/setup
156
156
with :
157
157
type : minimal
158
+ language : javascript
158
159
159
160
- name : Build '${{ matrix.client }}' client
160
161
if : ${{ steps.cache.outputs.cache-hit != 'true' }}
161
- run : yarn workspace algoliasearch-client-javascript build ${{ matrix.client }}
162
+ run : cd clients/ algoliasearch-client-javascript && yarn build ${{ matrix.client }}
162
163
163
164
- name : Run tests for 'client-common'
164
165
if : ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client == 'client-common' }}
165
- run : yarn workspace @experimental-api-clients-automation/client-common test
166
+ run : cd clients/algoliasearch-client-javascript && yarn workspace @experimental-api-clients-automation/client-common test
166
167
167
168
- name : Store '${{ matrix.client }}' JavaScript utils package
168
169
uses : actions/upload-artifact@v3
@@ -211,11 +212,17 @@ jobs:
211
212
212
213
- name : Setup
213
214
uses : ./.github/actions/setup
215
+ with :
216
+ language : ${{ matrix.client.language }}
214
217
215
218
- name : Generate clients
216
219
if : ${{ steps.cache.outputs.cache-hit != 'true' }}
217
220
run : yarn cli generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}
218
221
222
+ - name : Update `yarn.lock` for JavaScript
223
+ if : ${{ matrix.client.language == 'javascript' }}
224
+ run : cd ${{ matrix.client.path }} && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
225
+
219
226
- name : Build clients
220
227
if : ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language != 'php' }}
221
228
run : yarn cli build clients ${{ matrix.client.language }} ${{ matrix.client.toBuild }}
@@ -226,17 +233,35 @@ jobs:
226
233
227
234
- name : Run JavaScript 'algoliasearch' client tests
228
235
if : ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language == 'javascript' }}
229
- run : yarn workspace @experimental-api-clients-automation/algoliasearch test
236
+ run : cd ${{ matrix.client.path }} && yarn workspace @experimental-api-clients-automation/algoliasearch test
230
237
231
238
- name : Clean CTS output before generate
232
239
run : rm -rf ${{ matrix.client.testsToDelete }} || true
233
240
234
241
- name : Generate CTS
235
242
run : yarn cli cts generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}
236
243
237
- - name : Update `yarn.lock` for JavaScript release
238
- if : ${{ matrix.client.language == 'javascript' && (startsWith(github.head_ref, 'chore/prepare-release-') || github.ref == 'refs/heads/main') }}
239
- run : YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
244
+ # JavaScript test deps (needs to be cached because they are huge and inefficient)
245
+ - name : Get yarn js test cache directory path
246
+ if : ${{ matrix.client.language == 'javascript' }}
247
+ shell : bash
248
+ id : yarn-cache-dir-tests
249
+ run : echo "::set-output name=dir::$(cd ${{ matrix.client.testsRootFolder }} && yarn config get cacheFolder)"
250
+
251
+ - name : Restore Yarn js tests
252
+ if : ${{ matrix.client.language == 'javascript' }}
253
+ uses : actions/cache@v3
254
+ with :
255
+ path : ${{ steps.yarn-cache-dir-tests.outputs.dir || format('{0}/.yarn/cache', matrix.client.testsRootFolder) }}
256
+ # let yarn handle the cache hash
257
+ key : yarn-cache-tests-${{ env.CACHE_VERSION }}
258
+
259
+ - name : Cache js tests node modules
260
+ if : ${{ matrix.client.language == 'javascript' }}
261
+ uses : actions/cache@v3
262
+ with :
263
+ path : ${{ matrix.client.testsRootFolder }}/node_modules
264
+ key : node-modules-tests-${{ env.CACHE_VERSION }}-${{ hashFiles(format('{0}/.yarn.lock', matrix.client.testsRootFolder)) }}
240
265
241
266
- name : Run CTS
242
267
run : yarn cli cts run ${{ matrix.client.language }}
0 commit comments