Skip to content
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

feat: add arch to cache key #539

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions __tests__/cache-restore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('cache-restore tests', () => {

await restoreCache(lockFilePattern);

const expectedKey = `dotnet-cache-${process.env.RUNNER_OS}-hash`;
const expectedKey = `dotnet-cache-${process.env.RUNNER_OS}-${process.arch}-hash`;
expect(jest.mocked(core.saveState)).toHaveBeenCalledWith(
'CACHE_KEY',
expectedKey
Expand All @@ -66,7 +66,7 @@ describe('cache-restore tests', () => {
});

it('calls core.saveState("CACHE_RESULT") when cache.restoreCache() returns key', async () => {
const expectedKey = `dotnet-cache-${process.env.RUNNER_OS}-hash`;
const expectedKey = `dotnet-cache-${process.env.RUNNER_OS}-${process.arch}-hash`;
jest.mocked(glob.hashFiles).mockResolvedValue('hash');
jest.mocked(cache.restoreCache).mockResolvedValue(expectedKey);

Expand Down
3 changes: 2 additions & 1 deletion dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93479,7 +93479,8 @@ const restoreCache = (cacheDependencyPath) => __awaiter(void 0, void 0, void 0,
throw new Error('Some specified paths were not resolved, unable to cache dependencies.');
}
const platform = process.env.RUNNER_OS;
const primaryKey = `dotnet-cache-${platform}-${fileHash}`;
const arch = process.arch;
const primaryKey = `dotnet-cache-${platform}-${arch}-${fileHash}`;
core.debug(`primary key is ${primaryKey}`);
core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)();
Expand Down
3 changes: 2 additions & 1 deletion src/cache-restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export const restoreCache = async (cacheDependencyPath?: string) => {
}

const platform = process.env.RUNNER_OS;
const primaryKey = `dotnet-cache-${platform}-${fileHash}`;
const arch = process.arch;
const primaryKey = `dotnet-cache-${platform}-${arch}-${fileHash}`;
core.debug(`primary key is ${primaryKey}`);

core.saveState(State.CachePrimaryKey, primaryKey);
Expand Down