Skip to content

Commit

Permalink
feat(cache): Distinguish architectures of caches (#58)
Browse files Browse the repository at this point in the history
Signed-off-by: ❤是纱雾酱哟~ <[email protected]>
  • Loading branch information
Dragon1573 authored Jul 3, 2024
1 parent 568ddd6 commit 176c044
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/setup-pdm.js
Original file line number Diff line number Diff line change
Expand Up @@ -91048,8 +91048,8 @@ var cache3 = __toESM(require_cache2());
var import_glob = __toESM(require_glob2());
async function calculateCacheKeys(pythonVersion, cacheDependencyPath) {
const hash = await (0, import_glob.hashFiles)(cacheDependencyPath);
const primaryKey = `setup-pdm-${import_node_process3.default.env.RUNNER_OS}-python-${pythonVersion}-${hash}`;
const restoreKey = `setup-pdm-${import_node_process3.default.env.RUNNER_OS}-python-${pythonVersion}-`;
const primaryKey = `setup-pdm-${import_node_process3.default.env.RUNNER_OS}-${import_node_process3.default.env.RUNNER_ARCH}-python-${pythonVersion}-${hash}`;
const restoreKey = `setup-pdm-${import_node_process3.default.env.RUNNER_OS}-${import_node_process3.default.env.RUNNER_ARCH}-python-${pythonVersion}-`;
return { primaryKey, restoreKeys: [restoreKey] };
}
async function cacheDependencies(pdmBin, pythonVersion) {
Expand Down
4 changes: 2 additions & 2 deletions src/caches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { getOutput } from './utils'

async function calculateCacheKeys(pythonVersion: string, cacheDependencyPath: string): Promise<{ primaryKey: string, restoreKeys: string[] }> {
const hash = await hashFiles(cacheDependencyPath)
const primaryKey = `setup-pdm-${process.env.RUNNER_OS}-python-${pythonVersion}-${hash}`
const restoreKey = `setup-pdm-${process.env.RUNNER_OS}-python-${pythonVersion}-`
const primaryKey = `setup-pdm-${process.env.RUNNER_OS}-${process.env.RUNNER_ARCH}-python-${pythonVersion}-${hash}`
const restoreKey = `setup-pdm-${process.env.RUNNER_OS}-${process.env.RUNNER_ARCH}-python-${pythonVersion}-`
return { primaryKey, restoreKeys: [restoreKey] }
}

Expand Down

0 comments on commit 176c044

Please sign in to comment.