mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-05-17 14:44:46 +00:00
Add python version to cache key (#187)
Some checks are pending
Check dist/ / check-dist (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Release Drafter / ✏️ Draft release (push) Waiting to run
test-cache-windows / test-setup-cache (push) Waiting to run
test-cache-windows / test-restore-cache (push) Blocked by required conditions
test-cache / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Waiting to run
test-cache / test-setup-cache (auto, ubuntu-latest) (push) Waiting to run
test-cache / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Waiting to run
test-cache / test-setup-cache (false, ubuntu-latest) (push) Waiting to run
test-cache / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Waiting to run
test-cache / test-setup-cache (true, ubuntu-latest) (push) Waiting to run
test-cache / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Blocked by required conditions
test-cache / test-restore-cache (auto, ubuntu-latest) (push) Blocked by required conditions
test-cache / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Blocked by required conditions
test-cache / test-restore-cache (false, ubuntu-latest) (push) Blocked by required conditions
test-cache / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Blocked by required conditions
test-cache / test-restore-cache (true, ubuntu-latest) (push) Blocked by required conditions
test-cache / test-setup-cache-requirements-txt (push) Waiting to run
test-cache / test-restore-cache-requirements-txt (push) Blocked by required conditions
test-cache / test-setup-cache-dependency-glob (push) Waiting to run
test-cache / test-restore-cache-dependency-glob (push) Blocked by required conditions
test-cache / test-setup-cache-local (push) Waiting to run
test-cache / test-restore-cache-local (push) Blocked by required conditions
test-cache / test-tilde-expansion-cache-local-path (push) Waiting to run
test-cache / test-tilde-expansion-cache-dependency-glob (push) Waiting to run
test-cache / cleanup-tilde-expansion-tests (push) Blocked by required conditions
test-cache / test-no-python-version (push) Waiting to run
test-windows / test-default-version (push) Waiting to run
test / build (push) Waiting to run
test / test-default-version (macos-14) (push) Waiting to run
test / test-default-version (macos-latest) (push) Waiting to run
test / test-default-version (ubuntu-latest) (push) Waiting to run
test / test-specific-version (0.3) (push) Waiting to run
test / test-specific-version (0.3.0) (push) Waiting to run
test / test-specific-version (0.3.2) (push) Waiting to run
test / test-specific-version (0.3.x) (push) Waiting to run
test / test-specific-version (>=0.3.0) (push) Waiting to run
test / test-semver-range (push) Waiting to run
test / test-checksum (4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd, ubuntu-latest) (push) Waiting to run
test / test-checksum (a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218, macos-latest) (push) Waiting to run
test / test-with-explicit-token (push) Waiting to run
test / test-uvx (push) Waiting to run
test / test-tool-install (macos-14) (push) Waiting to run
test / test-tool-install (macos-latest) (push) Waiting to run
test / test-tool-install (ubuntu-latest) (push) Waiting to run
test / test-tool-install (windows-latest) (push) Waiting to run
test / test-tilde-expansion-tool-dirs (push) Waiting to run
test / test-python-version (3.12) (push) Waiting to run
test / test-python-version (3.13t) (push) Waiting to run
Some checks are pending
Check dist/ / check-dist (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Release Drafter / ✏️ Draft release (push) Waiting to run
test-cache-windows / test-setup-cache (push) Waiting to run
test-cache-windows / test-restore-cache (push) Blocked by required conditions
test-cache / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Waiting to run
test-cache / test-setup-cache (auto, ubuntu-latest) (push) Waiting to run
test-cache / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Waiting to run
test-cache / test-setup-cache (false, ubuntu-latest) (push) Waiting to run
test-cache / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Waiting to run
test-cache / test-setup-cache (true, ubuntu-latest) (push) Waiting to run
test-cache / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Blocked by required conditions
test-cache / test-restore-cache (auto, ubuntu-latest) (push) Blocked by required conditions
test-cache / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Blocked by required conditions
test-cache / test-restore-cache (false, ubuntu-latest) (push) Blocked by required conditions
test-cache / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Blocked by required conditions
test-cache / test-restore-cache (true, ubuntu-latest) (push) Blocked by required conditions
test-cache / test-setup-cache-requirements-txt (push) Waiting to run
test-cache / test-restore-cache-requirements-txt (push) Blocked by required conditions
test-cache / test-setup-cache-dependency-glob (push) Waiting to run
test-cache / test-restore-cache-dependency-glob (push) Blocked by required conditions
test-cache / test-setup-cache-local (push) Waiting to run
test-cache / test-restore-cache-local (push) Blocked by required conditions
test-cache / test-tilde-expansion-cache-local-path (push) Waiting to run
test-cache / test-tilde-expansion-cache-dependency-glob (push) Waiting to run
test-cache / cleanup-tilde-expansion-tests (push) Blocked by required conditions
test-cache / test-no-python-version (push) Waiting to run
test-windows / test-default-version (push) Waiting to run
test / build (push) Waiting to run
test / test-default-version (macos-14) (push) Waiting to run
test / test-default-version (macos-latest) (push) Waiting to run
test / test-default-version (ubuntu-latest) (push) Waiting to run
test / test-specific-version (0.3) (push) Waiting to run
test / test-specific-version (0.3.0) (push) Waiting to run
test / test-specific-version (0.3.2) (push) Waiting to run
test / test-specific-version (0.3.x) (push) Waiting to run
test / test-specific-version (>=0.3.0) (push) Waiting to run
test / test-semver-range (push) Waiting to run
test / test-checksum (4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd, ubuntu-latest) (push) Waiting to run
test / test-checksum (a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218, macos-latest) (push) Waiting to run
test / test-with-explicit-token (push) Waiting to run
test / test-uvx (push) Waiting to run
test / test-tool-install (macos-14) (push) Waiting to run
test / test-tool-install (macos-latest) (push) Waiting to run
test / test-tool-install (ubuntu-latest) (push) Waiting to run
test / test-tool-install (windows-latest) (push) Waiting to run
test / test-tilde-expansion-tool-dirs (push) Waiting to run
test / test-python-version (3.12) (push) Waiting to run
test / test-python-version (3.13t) (push) Waiting to run
Closes: #182
This commit is contained in:
parent
e3017a763c
commit
856099c958
8 changed files with 167 additions and 3 deletions
34
dist/setup/index.js
generated
vendored
34
dist/setup/index.js
generated
vendored
|
@ -96544,6 +96544,7 @@ const core = __importStar(__nccwpck_require__(7484));
|
|||
const inputs_1 = __nccwpck_require__(9612);
|
||||
const platforms_1 = __nccwpck_require__(8361);
|
||||
const hash_files_1 = __nccwpck_require__(9660);
|
||||
const exec = __importStar(__nccwpck_require__(5236));
|
||||
exports.STATE_CACHE_KEY = "cache-key";
|
||||
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||
const CACHE_VERSION = "1";
|
||||
|
@ -96579,7 +96580,38 @@ function computeKeys(version) {
|
|||
cacheDependencyPathHash += "no-dependency-glob";
|
||||
}
|
||||
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
|
||||
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${version}${cacheDependencyPathHash}${suffix}`;
|
||||
const pythonVersion = yield getPythonVersion();
|
||||
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${version}-${pythonVersion}${cacheDependencyPathHash}${suffix}`;
|
||||
});
|
||||
}
|
||||
function getPythonVersion() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (inputs_1.pythonVersion !== "") {
|
||||
return inputs_1.pythonVersion;
|
||||
}
|
||||
let output = "";
|
||||
const options = {
|
||||
silent: !core.isDebug(),
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
output += data.toString();
|
||||
},
|
||||
},
|
||||
};
|
||||
try {
|
||||
const execArgs = ["python", "find"];
|
||||
yield exec.exec("uv", execArgs, options);
|
||||
const pythonPath = output.trim();
|
||||
output = "";
|
||||
yield exec.exec(pythonPath, ["--version"], options);
|
||||
// output is like "Python 3.8.10"
|
||||
return output.split(" ")[1].trim();
|
||||
}
|
||||
catch (error) {
|
||||
const err = error;
|
||||
core.debug(`Failed to get python version from uv. Error: ${err.message}`);
|
||||
return "unknown";
|
||||
}
|
||||
});
|
||||
}
|
||||
function handleMatchResult(matchedKey, primaryKey) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue