Skip to content

fix(scripts): add yarn.lock to cache key deps #687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2022
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
3 changes: 0 additions & 3 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ outputs:
RUN_JS_UTILS:
description: Whether to build JS client common folders when RUN_JS is false
value: ${{ steps.js-utils.outputs.RUN_JS_UTILS }}
RUN_JS_TESTS:
description: Determine if the `client_javascript_tests` job should run
value: ${{ steps.diff.outputs.JS_COMMON_TESTS_CHANGED > 0 }}

RUN_CODEGEN:
description: Determine if the `codegen` job should run
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ jobs:
RUN_GEN_PHP: ${{ steps.setup.outputs.RUN_GEN_PHP }}

RUN_JS_UTILS: ${{ steps.setup.outputs.RUN_JS_UTILS }}
RUN_JS_TESTS: ${{ steps.setup.outputs.RUN_JS_TESTS }}

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

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

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

- name: Store '${{ matrix.client }}' JavaScript utils package
Expand Down
3 changes: 0 additions & 3 deletions scripts/ci/githubActions/setRunVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ export const COMMON_DEPENDENCIES = {
*/
export const DEPENDENCIES = {
...COMMON_DEPENDENCIES,
JS_COMMON_TESTS_CHANGED: [
`${JS_CLIENT_FOLDER}/packages/client-common/src/__tests__`,
],
JAVASCRIPT_UTILS_CHANGED: CLIENTS_JS_UTILS.map(
(clientName) => `${JS_CLIENT_FOLDER}/packages/${clientName}`
),
Expand Down
8 changes: 6 additions & 2 deletions scripts/ci/githubActions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ const commonCacheKey = (async function (): Promise<string> {
folders: { include: ['config'] },
files: { include: ['openapitools.json', 'clients.config.json'] },
});
const depsHash = await hashElement(toAbsolutePath('.'), {
encoding: 'hex',
files: { include: ['yarn.lock'] },
});

return `${ghHash.hash}-${scriptsHash.hash}-${configHash.hash}`;
return `${ghHash.hash}-${scriptsHash.hash}-${configHash.hash}-${depsHash}`;
})();

/**
* Compute a cache key based on the changes in the `paths` array of dependenciy.
* Compute a cache key based on the changes in the `paths` array of dependency.
*
* The `paths` parameter is an array of string, that needs to be treated as dependencies.
*/
Expand Down