mirror of
https://github.com/actions/setup-node.git
synced 2026-06-27 16:17:45 +00:00
fix: add arch to cached path
This commit is contained in:
parent
5e21ff4d9b
commit
343cc68d8f
@ -11,7 +11,11 @@ describe('cache-restore', () => {
|
||||
if (!process.env.RUNNER_OS) {
|
||||
process.env.RUNNER_OS = 'Linux';
|
||||
}
|
||||
if (!process.env.RUNNER_ARCH) {
|
||||
process.env.RUNNER_ARCH = 'X64';
|
||||
}
|
||||
const platform = process.env.RUNNER_OS;
|
||||
const arch = process.env.RUNNER_ARCH;
|
||||
const commonPath = '/some/random/path';
|
||||
const npmCachePath = `${commonPath}/npm`;
|
||||
const pnpmCachePath = `${commonPath}/pnpm`;
|
||||
@ -135,7 +139,7 @@ describe('cache-restore', () => {
|
||||
await restoreCache(packageManager, '');
|
||||
expect(hashFilesSpy).toHaveBeenCalled();
|
||||
expect(infoSpy).toHaveBeenCalledWith(
|
||||
`Cache restored from key: node-cache-${platform}-${packageManager}-${fileHash}`
|
||||
`Cache restored from key: node-cache-${platform}-${arch}-${packageManager}-${fileHash}`
|
||||
);
|
||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||
`${packageManager} cache is not found`
|
||||
|
||||
4561
dist/setup/index.js
vendored
4561
dist/setup/index.js
vendored
File diff suppressed because it is too large
Load Diff
@ -21,6 +21,7 @@ export const restoreCache = async (
|
||||
throw new Error(`Caching for '${packageManager}' is not supported`);
|
||||
}
|
||||
const platform = process.env.RUNNER_OS;
|
||||
const arch = process.env.RUNNER_ARCH;
|
||||
|
||||
const cachePaths = await getCacheDirectories(
|
||||
packageManagerInfo,
|
||||
@ -38,7 +39,7 @@ export const restoreCache = async (
|
||||
);
|
||||
}
|
||||
|
||||
const keyPrefix = `node-cache-${platform}-${packageManager}`;
|
||||
const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`;
|
||||
const primaryKey = `${keyPrefix}-${fileHash}`;
|
||||
core.debug(`primary key is ${primaryKey}`);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user