mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-12-09 11:01:17 +00:00
committed by
GitHub
parent
0439606c8e
commit
4180991cd9
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
@@ -649,6 +649,26 @@ jobs:
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test-cache-local-cache-disabled-but-explicit-path:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup without cache
|
||||
uses: ./
|
||||
with:
|
||||
enable-cache: false
|
||||
cache-local-path: /tmp/uv-cache-disabled
|
||||
|
||||
- name: Check UV_CACHE_DIR is set
|
||||
run: |
|
||||
if [ "$UV_CACHE_DIR" != "/tmp/uv-cache-disabled" ]; then
|
||||
echo "UV_CACHE_DIR should be set when cache is disabled but explicit path is provided"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test-setup-cache-local:
|
||||
runs-on: selfhosted-ubuntu-arm64
|
||||
steps:
|
||||
@@ -984,6 +1004,7 @@ jobs:
|
||||
- test-musl
|
||||
- test-cache-local
|
||||
- test-cache-local-cache-disabled
|
||||
- test-cache-local-cache-disabled-but-explicit-path
|
||||
- test-setup-cache
|
||||
- test-restore-cache
|
||||
- test-setup-cache-requirements-txt
|
||||
|
||||
60
dist/save-cache/index.js
generated
vendored
60
dist/save-cache/index.js
generated
vendored
@@ -90619,7 +90619,10 @@ async function restoreCache() {
|
||||
}
|
||||
let matchedKey;
|
||||
core.info(`Trying to restore uv cache from GitHub Actions cache with key: ${cacheKey}`);
|
||||
const cachePaths = [inputs_1.cacheLocalPath];
|
||||
if (inputs_1.cacheLocalPath === undefined) {
|
||||
throw new Error("cache-local-path is not set. Cannot restore cache without a valid cache path.");
|
||||
}
|
||||
const cachePaths = [inputs_1.cacheLocalPath.path];
|
||||
if (inputs_1.cachePython) {
|
||||
cachePaths.push(inputs_1.pythonDir);
|
||||
}
|
||||
@@ -90868,9 +90871,13 @@ async function saveCache() {
|
||||
if (inputs_1.pruneCache) {
|
||||
await pruneCache();
|
||||
}
|
||||
let actualCachePath = inputs_1.cacheLocalPath;
|
||||
if (process.env.UV_CACHE_DIR && process.env.UV_CACHE_DIR !== inputs_1.cacheLocalPath) {
|
||||
core.warning(`The environment variable UV_CACHE_DIR has been changed to "${process.env.UV_CACHE_DIR}", by an action or step running after astral-sh/setup-uv. This can lead to unexpected behavior. If you expected this to happen set the cache-local-path input to "${process.env.UV_CACHE_DIR}" instead of "${inputs_1.cacheLocalPath}".`);
|
||||
if (inputs_1.cacheLocalPath === undefined) {
|
||||
throw new Error("cache-local-path is not set. Cannot save cache without a valid cache path.");
|
||||
}
|
||||
let actualCachePath = inputs_1.cacheLocalPath.path;
|
||||
if (process.env.UV_CACHE_DIR &&
|
||||
process.env.UV_CACHE_DIR !== inputs_1.cacheLocalPath.path) {
|
||||
core.warning(`The environment variable UV_CACHE_DIR has been changed to "${process.env.UV_CACHE_DIR}", by an action or step running after astral-sh/setup-uv. This can lead to unexpected behavior. If you expected this to happen set the cache-local-path input to "${process.env.UV_CACHE_DIR}" instead of "${inputs_1.cacheLocalPath.path}".`);
|
||||
actualCachePath = process.env.UV_CACHE_DIR;
|
||||
}
|
||||
core.info(`Saving cache path: ${actualCachePath}`);
|
||||
@@ -91038,11 +91045,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolutionStrategy = exports.addProblemMatchers = exports.manifestFile = exports.githubToken = exports.pythonDir = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.cachePython = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.saveCache = exports.restoreCache = exports.enableCache = exports.checkSum = exports.activateEnvironment = exports.pythonVersion = exports.versionFile = exports.version = exports.workingDirectory = void 0;
|
||||
exports.resolutionStrategy = exports.addProblemMatchers = exports.manifestFile = exports.githubToken = exports.pythonDir = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.cachePython = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.saveCache = exports.restoreCache = exports.enableCache = exports.checkSum = exports.activateEnvironment = exports.pythonVersion = exports.versionFile = exports.version = exports.workingDirectory = exports.CacheLocalSource = void 0;
|
||||
exports.getUvPythonDir = getUvPythonDir;
|
||||
const node_path_1 = __importDefault(__nccwpck_require__(6760));
|
||||
const core = __importStar(__nccwpck_require__(7484));
|
||||
const config_file_1 = __nccwpck_require__(7846);
|
||||
var CacheLocalSource;
|
||||
(function (CacheLocalSource) {
|
||||
CacheLocalSource[CacheLocalSource["Input"] = 0] = "Input";
|
||||
CacheLocalSource[CacheLocalSource["Config"] = 1] = "Config";
|
||||
CacheLocalSource[CacheLocalSource["Env"] = 2] = "Env";
|
||||
CacheLocalSource[CacheLocalSource["Default"] = 3] = "Default";
|
||||
})(CacheLocalSource || (exports.CacheLocalSource = CacheLocalSource = {}));
|
||||
exports.workingDirectory = core.getInput("working-directory");
|
||||
exports.version = core.getInput("version");
|
||||
exports.versionFile = getVersionFile();
|
||||
@@ -91113,26 +91127,40 @@ function getCacheLocalPath() {
|
||||
const cacheLocalPathInput = core.getInput("cache-local-path");
|
||||
if (cacheLocalPathInput !== "") {
|
||||
const tildeExpanded = expandTilde(cacheLocalPathInput);
|
||||
return resolveRelativePath(tildeExpanded);
|
||||
return {
|
||||
path: resolveRelativePath(tildeExpanded),
|
||||
source: CacheLocalSource.Input,
|
||||
};
|
||||
}
|
||||
const cacheDirFromConfig = getCacheDirFromConfig();
|
||||
if (cacheDirFromConfig !== undefined) {
|
||||
return cacheDirFromConfig;
|
||||
return { path: cacheDirFromConfig, source: CacheLocalSource.Config };
|
||||
}
|
||||
if (process.env.UV_CACHE_DIR !== undefined) {
|
||||
core.info(`UV_CACHE_DIR is already set to ${process.env.UV_CACHE_DIR}`);
|
||||
return process.env.UV_CACHE_DIR;
|
||||
return { path: process.env.UV_CACHE_DIR, source: CacheLocalSource.Env };
|
||||
}
|
||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||
if (process.env.RUNNER_TEMP !== undefined) {
|
||||
return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`;
|
||||
if (getEnableCache()) {
|
||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||
if (process.env.RUNNER_TEMP !== undefined) {
|
||||
return {
|
||||
path: `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`,
|
||||
source: CacheLocalSource.Default,
|
||||
};
|
||||
}
|
||||
throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input");
|
||||
}
|
||||
throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input");
|
||||
if (process.platform === "win32") {
|
||||
return {
|
||||
path: `${process.env.APPDATA}${node_path_1.default.sep}uv${node_path_1.default.sep}cache`,
|
||||
source: CacheLocalSource.Default,
|
||||
};
|
||||
}
|
||||
return {
|
||||
path: `${process.env.HOME}${node_path_1.default.sep}.cache${node_path_1.default.sep}uv`,
|
||||
source: CacheLocalSource.Default,
|
||||
};
|
||||
}
|
||||
if (process.platform === "win32") {
|
||||
return `${process.env.APPDATA}${node_path_1.default.sep}uv${node_path_1.default.sep}cache`;
|
||||
}
|
||||
return `${process.env.HOME}${node_path_1.default.sep}.cache${node_path_1.default.sep}uv`;
|
||||
}
|
||||
function getCacheDirFromConfig() {
|
||||
for (const filePath of [exports.versionFile, "uv.toml", "pyproject.toml"]) {
|
||||
|
||||
60
dist/setup/index.js
generated
vendored
60
dist/setup/index.js
generated
vendored
@@ -91522,7 +91522,10 @@ async function restoreCache() {
|
||||
}
|
||||
let matchedKey;
|
||||
core.info(`Trying to restore uv cache from GitHub Actions cache with key: ${cacheKey}`);
|
||||
const cachePaths = [inputs_1.cacheLocalPath];
|
||||
if (inputs_1.cacheLocalPath === undefined) {
|
||||
throw new Error("cache-local-path is not set. Cannot restore cache without a valid cache path.");
|
||||
}
|
||||
const cachePaths = [inputs_1.cacheLocalPath.path];
|
||||
if (inputs_1.cachePython) {
|
||||
cachePaths.push(inputs_1.pythonDir);
|
||||
}
|
||||
@@ -96168,7 +96171,6 @@ const core = __importStar(__nccwpck_require__(7484));
|
||||
const exec = __importStar(__nccwpck_require__(5236));
|
||||
const restore_cache_1 = __nccwpck_require__(5391);
|
||||
const download_version_1 = __nccwpck_require__(8255);
|
||||
const config_file_1 = __nccwpck_require__(7846);
|
||||
const constants_1 = __nccwpck_require__(6156);
|
||||
const inputs_1 = __nccwpck_require__(9612);
|
||||
const platforms_1 = __nccwpck_require__(8361);
|
||||
@@ -96336,14 +96338,13 @@ async function activateEnvironment() {
|
||||
}
|
||||
}
|
||||
function setCacheDir() {
|
||||
if (inputs_1.enableCache) {
|
||||
const cacheDirFromConfig = (0, config_file_1.getConfigValueFromTomlFile)("", "cache-dir");
|
||||
if (cacheDirFromConfig !== undefined) {
|
||||
if (inputs_1.cacheLocalPath !== undefined) {
|
||||
if (inputs_1.cacheLocalPath.source === inputs_1.CacheLocalSource.Config) {
|
||||
core.info("Using cache-dir from uv config file, not modifying UV_CACHE_DIR");
|
||||
return;
|
||||
}
|
||||
core.exportVariable("UV_CACHE_DIR", inputs_1.cacheLocalPath);
|
||||
core.info(`Set UV_CACHE_DIR to ${inputs_1.cacheLocalPath}`);
|
||||
core.exportVariable("UV_CACHE_DIR", inputs_1.cacheLocalPath.path);
|
||||
core.info(`Set UV_CACHE_DIR to ${inputs_1.cacheLocalPath.path}`);
|
||||
}
|
||||
}
|
||||
function addMatchers() {
|
||||
@@ -96505,11 +96506,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolutionStrategy = exports.addProblemMatchers = exports.manifestFile = exports.githubToken = exports.pythonDir = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.cachePython = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.saveCache = exports.restoreCache = exports.enableCache = exports.checkSum = exports.activateEnvironment = exports.pythonVersion = exports.versionFile = exports.version = exports.workingDirectory = void 0;
|
||||
exports.resolutionStrategy = exports.addProblemMatchers = exports.manifestFile = exports.githubToken = exports.pythonDir = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.cachePython = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.saveCache = exports.restoreCache = exports.enableCache = exports.checkSum = exports.activateEnvironment = exports.pythonVersion = exports.versionFile = exports.version = exports.workingDirectory = exports.CacheLocalSource = void 0;
|
||||
exports.getUvPythonDir = getUvPythonDir;
|
||||
const node_path_1 = __importDefault(__nccwpck_require__(6760));
|
||||
const core = __importStar(__nccwpck_require__(7484));
|
||||
const config_file_1 = __nccwpck_require__(7846);
|
||||
var CacheLocalSource;
|
||||
(function (CacheLocalSource) {
|
||||
CacheLocalSource[CacheLocalSource["Input"] = 0] = "Input";
|
||||
CacheLocalSource[CacheLocalSource["Config"] = 1] = "Config";
|
||||
CacheLocalSource[CacheLocalSource["Env"] = 2] = "Env";
|
||||
CacheLocalSource[CacheLocalSource["Default"] = 3] = "Default";
|
||||
})(CacheLocalSource || (exports.CacheLocalSource = CacheLocalSource = {}));
|
||||
exports.workingDirectory = core.getInput("working-directory");
|
||||
exports.version = core.getInput("version");
|
||||
exports.versionFile = getVersionFile();
|
||||
@@ -96580,26 +96588,40 @@ function getCacheLocalPath() {
|
||||
const cacheLocalPathInput = core.getInput("cache-local-path");
|
||||
if (cacheLocalPathInput !== "") {
|
||||
const tildeExpanded = expandTilde(cacheLocalPathInput);
|
||||
return resolveRelativePath(tildeExpanded);
|
||||
return {
|
||||
path: resolveRelativePath(tildeExpanded),
|
||||
source: CacheLocalSource.Input,
|
||||
};
|
||||
}
|
||||
const cacheDirFromConfig = getCacheDirFromConfig();
|
||||
if (cacheDirFromConfig !== undefined) {
|
||||
return cacheDirFromConfig;
|
||||
return { path: cacheDirFromConfig, source: CacheLocalSource.Config };
|
||||
}
|
||||
if (process.env.UV_CACHE_DIR !== undefined) {
|
||||
core.info(`UV_CACHE_DIR is already set to ${process.env.UV_CACHE_DIR}`);
|
||||
return process.env.UV_CACHE_DIR;
|
||||
return { path: process.env.UV_CACHE_DIR, source: CacheLocalSource.Env };
|
||||
}
|
||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||
if (process.env.RUNNER_TEMP !== undefined) {
|
||||
return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`;
|
||||
if (getEnableCache()) {
|
||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||
if (process.env.RUNNER_TEMP !== undefined) {
|
||||
return {
|
||||
path: `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`,
|
||||
source: CacheLocalSource.Default,
|
||||
};
|
||||
}
|
||||
throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input");
|
||||
}
|
||||
throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input");
|
||||
if (process.platform === "win32") {
|
||||
return {
|
||||
path: `${process.env.APPDATA}${node_path_1.default.sep}uv${node_path_1.default.sep}cache`,
|
||||
source: CacheLocalSource.Default,
|
||||
};
|
||||
}
|
||||
return {
|
||||
path: `${process.env.HOME}${node_path_1.default.sep}.cache${node_path_1.default.sep}uv`,
|
||||
source: CacheLocalSource.Default,
|
||||
};
|
||||
}
|
||||
if (process.platform === "win32") {
|
||||
return `${process.env.APPDATA}${node_path_1.default.sep}uv${node_path_1.default.sep}cache`;
|
||||
}
|
||||
return `${process.env.HOME}${node_path_1.default.sep}.cache${node_path_1.default.sep}uv`;
|
||||
}
|
||||
function getCacheDirFromConfig() {
|
||||
for (const filePath of [exports.versionFile, "uv.toml", "pyproject.toml"]) {
|
||||
|
||||
@@ -134,6 +134,10 @@ It defaults to `setup-uv-cache` in the `TMP` dir, `D:\a\_temp\setup-uv-cache` on
|
||||
> If you configured [cache-dir](https://docs.astral.sh/uv/reference/settings/#cache-dir) in your
|
||||
> config file then it is also respected and this action will not set `UV_CACHE_DIR`.
|
||||
|
||||
> [!NOTE]
|
||||
> If caching is disabled, you can still use `cache-local-path` so this action sets `UV_CACHE_DIR`
|
||||
> to your desired path.
|
||||
|
||||
```yaml
|
||||
- name: Define a custom uv cache path
|
||||
uses: astral-sh/setup-uv@v7
|
||||
|
||||
7
src/cache/restore-cache.ts
vendored
7
src/cache/restore-cache.ts
vendored
@@ -32,7 +32,12 @@ export async function restoreCache(): Promise<void> {
|
||||
core.info(
|
||||
`Trying to restore uv cache from GitHub Actions cache with key: ${cacheKey}`,
|
||||
);
|
||||
const cachePaths = [cacheLocalPath];
|
||||
if (cacheLocalPath === undefined) {
|
||||
throw new Error(
|
||||
"cache-local-path is not set. Cannot restore cache without a valid cache path.",
|
||||
);
|
||||
}
|
||||
const cachePaths = [cacheLocalPath.path];
|
||||
if (cachePython) {
|
||||
cachePaths.push(pythonDir);
|
||||
}
|
||||
|
||||
@@ -59,10 +59,18 @@ async function saveCache(): Promise<void> {
|
||||
await pruneCache();
|
||||
}
|
||||
|
||||
let actualCachePath = cacheLocalPath;
|
||||
if (process.env.UV_CACHE_DIR && process.env.UV_CACHE_DIR !== cacheLocalPath) {
|
||||
if (cacheLocalPath === undefined) {
|
||||
throw new Error(
|
||||
"cache-local-path is not set. Cannot save cache without a valid cache path.",
|
||||
);
|
||||
}
|
||||
let actualCachePath = cacheLocalPath.path;
|
||||
if (
|
||||
process.env.UV_CACHE_DIR &&
|
||||
process.env.UV_CACHE_DIR !== cacheLocalPath.path
|
||||
) {
|
||||
core.warning(
|
||||
`The environment variable UV_CACHE_DIR has been changed to "${process.env.UV_CACHE_DIR}", by an action or step running after astral-sh/setup-uv. This can lead to unexpected behavior. If you expected this to happen set the cache-local-path input to "${process.env.UV_CACHE_DIR}" instead of "${cacheLocalPath}".`,
|
||||
`The environment variable UV_CACHE_DIR has been changed to "${process.env.UV_CACHE_DIR}", by an action or step running after astral-sh/setup-uv. This can lead to unexpected behavior. If you expected this to happen set the cache-local-path input to "${process.env.UV_CACHE_DIR}" instead of "${cacheLocalPath.path}".`,
|
||||
);
|
||||
actualCachePath = process.env.UV_CACHE_DIR;
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ import {
|
||||
resolveVersion,
|
||||
tryGetFromToolCache,
|
||||
} from "./download/download-version";
|
||||
import { getConfigValueFromTomlFile } from "./utils/config-file";
|
||||
import { STATE_UV_PATH, STATE_UV_VERSION } from "./utils/constants";
|
||||
import {
|
||||
activateEnvironment as activateEnvironmentInput,
|
||||
addProblemMatchers,
|
||||
CacheLocalSource,
|
||||
cacheLocalPath,
|
||||
checkSum,
|
||||
enableCache,
|
||||
@@ -252,16 +252,15 @@ async function activateEnvironment(): Promise<void> {
|
||||
}
|
||||
|
||||
function setCacheDir(): void {
|
||||
if (enableCache) {
|
||||
const cacheDirFromConfig = getConfigValueFromTomlFile("", "cache-dir");
|
||||
if (cacheDirFromConfig !== undefined) {
|
||||
if (cacheLocalPath !== undefined) {
|
||||
if (cacheLocalPath.source === CacheLocalSource.Config) {
|
||||
core.info(
|
||||
"Using cache-dir from uv config file, not modifying UV_CACHE_DIR",
|
||||
);
|
||||
return;
|
||||
}
|
||||
core.exportVariable("UV_CACHE_DIR", cacheLocalPath);
|
||||
core.info(`Set UV_CACHE_DIR to ${cacheLocalPath}`);
|
||||
core.exportVariable("UV_CACHE_DIR", cacheLocalPath.path);
|
||||
core.info(`Set UV_CACHE_DIR to ${cacheLocalPath.path}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,13 @@ import path from "node:path";
|
||||
import * as core from "@actions/core";
|
||||
import { getConfigValueFromTomlFile } from "./config-file";
|
||||
|
||||
export enum CacheLocalSource {
|
||||
Input,
|
||||
Config,
|
||||
Env,
|
||||
Default,
|
||||
}
|
||||
|
||||
export const workingDirectory = core.getInput("working-directory");
|
||||
export const version = core.getInput("version");
|
||||
export const versionFile = getVersionFile();
|
||||
@@ -80,32 +87,51 @@ function getToolDir(): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getCacheLocalPath(): string {
|
||||
function getCacheLocalPath():
|
||||
| {
|
||||
path: string;
|
||||
source: CacheLocalSource;
|
||||
}
|
||||
| undefined {
|
||||
const cacheLocalPathInput = core.getInput("cache-local-path");
|
||||
if (cacheLocalPathInput !== "") {
|
||||
const tildeExpanded = expandTilde(cacheLocalPathInput);
|
||||
return resolveRelativePath(tildeExpanded);
|
||||
return {
|
||||
path: resolveRelativePath(tildeExpanded),
|
||||
source: CacheLocalSource.Input,
|
||||
};
|
||||
}
|
||||
const cacheDirFromConfig = getCacheDirFromConfig();
|
||||
if (cacheDirFromConfig !== undefined) {
|
||||
return cacheDirFromConfig;
|
||||
return { path: cacheDirFromConfig, source: CacheLocalSource.Config };
|
||||
}
|
||||
if (process.env.UV_CACHE_DIR !== undefined) {
|
||||
core.info(`UV_CACHE_DIR is already set to ${process.env.UV_CACHE_DIR}`);
|
||||
return process.env.UV_CACHE_DIR;
|
||||
return { path: process.env.UV_CACHE_DIR, source: CacheLocalSource.Env };
|
||||
}
|
||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||
if (process.env.RUNNER_TEMP !== undefined) {
|
||||
return `${process.env.RUNNER_TEMP}${path.sep}setup-uv-cache`;
|
||||
if (getEnableCache()) {
|
||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||
if (process.env.RUNNER_TEMP !== undefined) {
|
||||
return {
|
||||
path: `${process.env.RUNNER_TEMP}${path.sep}setup-uv-cache`,
|
||||
source: CacheLocalSource.Default,
|
||||
};
|
||||
}
|
||||
throw Error(
|
||||
"Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input",
|
||||
);
|
||||
}
|
||||
throw Error(
|
||||
"Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input",
|
||||
);
|
||||
if (process.platform === "win32") {
|
||||
return {
|
||||
path: `${process.env.APPDATA}${path.sep}uv${path.sep}cache`,
|
||||
source: CacheLocalSource.Default,
|
||||
};
|
||||
}
|
||||
return {
|
||||
path: `${process.env.HOME}${path.sep}.cache${path.sep}uv`,
|
||||
source: CacheLocalSource.Default,
|
||||
};
|
||||
}
|
||||
if (process.platform === "win32") {
|
||||
return `${process.env.APPDATA}${path.sep}uv${path.sep}cache`;
|
||||
}
|
||||
return `${process.env.HOME}${path.sep}.cache${path.sep}uv`;
|
||||
}
|
||||
|
||||
function getCacheDirFromConfig(): string | undefined {
|
||||
|
||||
Reference in New Issue
Block a user