Skip to content

Commit 0875ec6

Browse files
authored
fix(scripts): add yarn.lock to cache key deps (#687)
1 parent 81bf615 commit 0875ec6

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

.github/actions/setup/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ outputs:
134134
RUN_JS_UTILS:
135135
description: Whether to build JS client common folders when RUN_JS is false
136136
value: ${{ steps.js-utils.outputs.RUN_JS_UTILS }}
137-
RUN_JS_TESTS:
138-
description: Determine if the `client_javascript_tests` job should run
139-
value: ${{ steps.diff.outputs.JS_COMMON_TESTS_CHANGED > 0 }}
140137

141138
RUN_CODEGEN:
142139
description: Determine if the `codegen` job should run

.github/workflows/check.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ jobs:
6767
RUN_GEN_PHP: ${{ steps.setup.outputs.RUN_GEN_PHP }}
6868

6969
RUN_JS_UTILS: ${{ steps.setup.outputs.RUN_JS_UTILS }}
70-
RUN_JS_TESTS: ${{ steps.setup.outputs.RUN_JS_TESTS }}
7170

7271
RUN_CODEGEN: ${{ steps.setup.outputs.RUN_CODEGEN }}
7372

@@ -162,10 +161,7 @@ jobs:
162161
run: yarn workspace algoliasearch-client-javascript build ${{ matrix.client }}
163162

164163
- name: Run tests for 'client-common'
165-
if: ${{
166-
steps.cache.outputs.cache-hit != 'true' &&
167-
needs.setup.outputs.RUN_JS_TESTS == 'true' &&
168-
matrix.client == 'client-common' }}
164+
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client == 'client-common' }}
169165
run: yarn workspace @experimental-api-clients-automation/client-common test
170166

171167
- name: Store '${{ matrix.client }}' JavaScript utils package

scripts/ci/githubActions/setRunVariables.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ export const COMMON_DEPENDENCIES = {
4545
*/
4646
export const DEPENDENCIES = {
4747
...COMMON_DEPENDENCIES,
48-
JS_COMMON_TESTS_CHANGED: [
49-
`${JS_CLIENT_FOLDER}/packages/client-common/src/__tests__`,
50-
],
5148
JAVASCRIPT_UTILS_CHANGED: CLIENTS_JS_UTILS.map(
5249
(clientName) => `${JS_CLIENT_FOLDER}/packages/${clientName}`
5350
),

scripts/ci/githubActions/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ const commonCacheKey = (async function (): Promise<string> {
2424
folders: { include: ['config'] },
2525
files: { include: ['openapitools.json', 'clients.config.json'] },
2626
});
27+
const depsHash = await hashElement(toAbsolutePath('.'), {
28+
encoding: 'hex',
29+
files: { include: ['yarn.lock'] },
30+
});
2731

28-
return `${ghHash.hash}-${scriptsHash.hash}-${configHash.hash}`;
32+
return `${ghHash.hash}-${scriptsHash.hash}-${configHash.hash}-${depsHash}`;
2933
})();
3034

3135
/**
32-
* Compute a cache key based on the changes in the `paths` array of dependenciy.
36+
* Compute a cache key based on the changes in the `paths` array of dependency.
3337
*
3438
* The `paths` parameter is an array of string, that needs to be treated as dependencies.
3539
*/

0 commit comments

Comments
 (0)