mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-05-23 13:51:53 +00:00
feat: support custom github url (#414)
Some checks failed
test / test-specific-version (0.3.0) (push) Successful in 16s
test / test-default-version (ubuntu-latest) (push) Successful in 21s
CodeQL / Analyze (TypeScript) (push) Failing after 32s
test / test-specific-version (0.3) (push) Failing after 26s
test / test-semver-range (ubuntu-latest) (push) Successful in 31s
test / lint (push) Successful in 1m15s
test / test-no-python-version (push) Failing after 14m23s
test / test-cache-local (map[expected-cache-dir:/home/runner/work/_temp/setup-uv-cache os:ubuntu-latest]) (push) Failing after 14m23s
test / test-setup-cache-dependency-glob (push) Failing after 14m23s
test / test-setup-cache-requirements-txt (push) Failing after 14m24s
test / test-setup-cache (true, ubuntu-latest) (push) Failing after 14m25s
test / test-setup-cache (false, ubuntu-latest) (push) Failing after 14m27s
test / test-setup-cache (auto, ubuntu-latest) (push) Failing after 14m28s
test / test-musl (push) Failing after 14m28s
test / test-activate-environment (ubuntu-latest) (push) Failing after 14m30s
test / test-python-version (ubuntu-latest) (push) Failing after 14m31s
test / test-tool-install (ubuntu-latest) (push) Failing after 14m32s
test / test-uvx (push) Failing after 14m33s
test / test-with-explicit-token (push) Failing after 14m34s
test / test-checksum (map[checksum:4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd os:ubuntu-latest]) (push) Failing after 14m35s
test / test-uv-file-version (push) Failing after 14m36s
test / test-malformed-pyproject-file-fallback (push) Failing after 14m38s
test / test-pyproject-file-version (push) Failing after 14m39s
test / test-pep440-version (push) Failing after 14m39s
test / test-specific-version (>=0.3.0) (push) Failing after 14m42s
test / test-specific-version (0.3.x) (push) Failing after 14m43s
test / test-specific-version (0.3.2) (push) Failing after 14m44s
Release Drafter / ✏️ Draft release (push) Has been cancelled
test / test-default-version (macos-14) (push) Has been cancelled
test / test-default-version (macos-latest) (push) Has been cancelled
test / test-default-version (windows-latest) (push) Has been cancelled
test / test-semver-range (selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-checksum (map[checksum:a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218 os:macos-latest]) (push) Has been cancelled
test / test-tool-install (macos-14) (push) Has been cancelled
test / test-tool-install (macos-latest) (push) Has been cancelled
test / test-tool-install (windows-latest) (push) Has been cancelled
test / test-tilde-expansion-tool-dirs (push) Has been cancelled
test / test-python-version (macos-latest) (push) Has been cancelled
test / test-python-version (windows-latest) (push) Has been cancelled
test / test-activate-environment (macos-latest) (push) Has been cancelled
test / test-activate-environment (windows-latest) (push) Has been cancelled
test / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (auto, windows-latest) (push) Has been cancelled
test / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (false, windows-latest) (push) Has been cancelled
test / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (true, windows-latest) (push) Has been cancelled
test / test-cache-local (map[expected-cache-dir:/home/ubuntu/.cache/uv os:selfhosted-ubuntu-arm64]) (push) Has been cancelled
test / test-cache-local (map[expected-cache-dir:D:\a\_temp\setup-uv-cache os:windows-latest]) (push) Has been cancelled
test / test-setup-cache-local (push) Has been cancelled
test / test-tilde-expansion-cache-local-path (push) Has been cancelled
test / test-tilde-expansion-cache-dependency-glob (push) Has been cancelled
test / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (auto, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (auto, windows-latest) (push) Has been cancelled
test / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (false, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (false, windows-latest) (push) Has been cancelled
test / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (true, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (true, windows-latest) (push) Has been cancelled
test / test-restore-cache-requirements-txt (push) Has been cancelled
test / test-restore-cache-dependency-glob (push) Has been cancelled
test / test-restore-cache-local (push) Has been cancelled
test / cleanup-tilde-expansion-tests (push) Has been cancelled
test / all-tests-passed (push) Has been cancelled
Update known versions / build (push) Has been cancelled
Some checks failed
test / test-specific-version (0.3.0) (push) Successful in 16s
test / test-default-version (ubuntu-latest) (push) Successful in 21s
CodeQL / Analyze (TypeScript) (push) Failing after 32s
test / test-specific-version (0.3) (push) Failing after 26s
test / test-semver-range (ubuntu-latest) (push) Successful in 31s
test / lint (push) Successful in 1m15s
test / test-no-python-version (push) Failing after 14m23s
test / test-cache-local (map[expected-cache-dir:/home/runner/work/_temp/setup-uv-cache os:ubuntu-latest]) (push) Failing after 14m23s
test / test-setup-cache-dependency-glob (push) Failing after 14m23s
test / test-setup-cache-requirements-txt (push) Failing after 14m24s
test / test-setup-cache (true, ubuntu-latest) (push) Failing after 14m25s
test / test-setup-cache (false, ubuntu-latest) (push) Failing after 14m27s
test / test-setup-cache (auto, ubuntu-latest) (push) Failing after 14m28s
test / test-musl (push) Failing after 14m28s
test / test-activate-environment (ubuntu-latest) (push) Failing after 14m30s
test / test-python-version (ubuntu-latest) (push) Failing after 14m31s
test / test-tool-install (ubuntu-latest) (push) Failing after 14m32s
test / test-uvx (push) Failing after 14m33s
test / test-with-explicit-token (push) Failing after 14m34s
test / test-checksum (map[checksum:4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd os:ubuntu-latest]) (push) Failing after 14m35s
test / test-uv-file-version (push) Failing after 14m36s
test / test-malformed-pyproject-file-fallback (push) Failing after 14m38s
test / test-pyproject-file-version (push) Failing after 14m39s
test / test-pep440-version (push) Failing after 14m39s
test / test-specific-version (>=0.3.0) (push) Failing after 14m42s
test / test-specific-version (0.3.x) (push) Failing after 14m43s
test / test-specific-version (0.3.2) (push) Failing after 14m44s
Release Drafter / ✏️ Draft release (push) Has been cancelled
test / test-default-version (macos-14) (push) Has been cancelled
test / test-default-version (macos-latest) (push) Has been cancelled
test / test-default-version (windows-latest) (push) Has been cancelled
test / test-semver-range (selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-checksum (map[checksum:a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218 os:macos-latest]) (push) Has been cancelled
test / test-tool-install (macos-14) (push) Has been cancelled
test / test-tool-install (macos-latest) (push) Has been cancelled
test / test-tool-install (windows-latest) (push) Has been cancelled
test / test-tilde-expansion-tool-dirs (push) Has been cancelled
test / test-python-version (macos-latest) (push) Has been cancelled
test / test-python-version (windows-latest) (push) Has been cancelled
test / test-activate-environment (macos-latest) (push) Has been cancelled
test / test-activate-environment (windows-latest) (push) Has been cancelled
test / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (auto, windows-latest) (push) Has been cancelled
test / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (false, windows-latest) (push) Has been cancelled
test / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (true, windows-latest) (push) Has been cancelled
test / test-cache-local (map[expected-cache-dir:/home/ubuntu/.cache/uv os:selfhosted-ubuntu-arm64]) (push) Has been cancelled
test / test-cache-local (map[expected-cache-dir:D:\a\_temp\setup-uv-cache os:windows-latest]) (push) Has been cancelled
test / test-setup-cache-local (push) Has been cancelled
test / test-tilde-expansion-cache-local-path (push) Has been cancelled
test / test-tilde-expansion-cache-dependency-glob (push) Has been cancelled
test / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (auto, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (auto, windows-latest) (push) Has been cancelled
test / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (false, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (false, windows-latest) (push) Has been cancelled
test / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (true, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (true, windows-latest) (push) Has been cancelled
test / test-restore-cache-requirements-txt (push) Has been cancelled
test / test-restore-cache-dependency-glob (push) Has been cancelled
test / test-restore-cache-local (push) Has been cancelled
test / cleanup-tilde-expansion-tests (push) Has been cancelled
test / all-tests-passed (push) Has been cancelled
Update known versions / build (push) Has been cancelled
Fix #344
This commit is contained in:
parent
71bb8825e4
commit
0e0f4bfefa
@ -18,6 +18,10 @@ inputs:
|
||||
checksum:
|
||||
description: "The checksum of the uv version to install"
|
||||
required: false
|
||||
server-url:
|
||||
description: "The server url to use when downloading uv"
|
||||
required: false
|
||||
default: "https://github.com"
|
||||
github-token:
|
||||
description:
|
||||
"Used to increase the rate limit when retrieving versions and downloading uv."
|
||||
|
6
dist/save-cache/index.js
generated
vendored
6
dist/save-cache/index.js
generated
vendored
@ -88997,7 +88997,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.githubToken = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.workingDirectory = exports.activateEnvironment = exports.pythonVersion = exports.version = void 0;
|
||||
exports.githubToken = exports.serverUrl = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.workingDirectory = exports.activateEnvironment = exports.pythonVersion = exports.version = void 0;
|
||||
const core = __importStar(__nccwpck_require__(7484));
|
||||
const node_path_1 = __importDefault(__nccwpck_require__(6760));
|
||||
exports.version = core.getInput("version");
|
||||
@ -89014,6 +89014,7 @@ exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "tru
|
||||
exports.ignoreEmptyWorkdir = core.getInput("ignore-empty-workdir") === "true";
|
||||
exports.toolBinDir = getToolBinDir();
|
||||
exports.toolDir = getToolDir();
|
||||
exports.serverUrl = getServerUrl();
|
||||
exports.githubToken = core.getInput("github-token");
|
||||
function getEnableCache() {
|
||||
const enableCacheInput = core.getInput("enable-cache");
|
||||
@ -89070,6 +89071,9 @@ function expandTilde(input) {
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function getServerUrl() {
|
||||
return core.getInput("server-url");
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
12
dist/setup/index.js
generated
vendored
12
dist/setup/index.js
generated
vendored
@ -124202,14 +124202,14 @@ function tryGetFromToolCache(arch, version) {
|
||||
const installedPath = tc.find(constants_1.TOOL_CACHE_NAME, resolvedVersion, arch);
|
||||
return { version: resolvedVersion, installedPath };
|
||||
}
|
||||
async function downloadVersion(platform, arch, version, checkSum, githubToken) {
|
||||
async function downloadVersion(serverUrl, platform, arch, version, checkSum, githubToken) {
|
||||
const resolvedVersion = await resolveVersion(version, githubToken);
|
||||
const artifact = `uv-${arch}-${platform}`;
|
||||
let extension = ".tar.gz";
|
||||
if (platform === "pc-windows-msvc") {
|
||||
extension = ".zip";
|
||||
}
|
||||
const downloadUrl = `https://github.com/${constants_1.OWNER}/${constants_1.REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
|
||||
const downloadUrl = `${serverUrl}/${constants_1.OWNER}/${constants_1.REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
|
||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||
const downloadPath = await tc.downloadTool(downloadUrl, undefined, githubToken);
|
||||
await (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, resolvedVersion);
|
||||
@ -124502,7 +124502,7 @@ async function setupUv(platform, arch, checkSum, githubToken) {
|
||||
version: toolCacheResult.version,
|
||||
};
|
||||
}
|
||||
const downloadVersionResult = await (0, download_version_1.downloadVersion)(platform, arch, resolvedVersion, checkSum, githubToken);
|
||||
const downloadVersionResult = await (0, download_version_1.downloadVersion)(inputs_1.serverUrl, platform, arch, resolvedVersion, checkSum, githubToken);
|
||||
return {
|
||||
uvDir: downloadVersionResult.cachedToolDir,
|
||||
version: downloadVersionResult.version,
|
||||
@ -124723,7 +124723,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.githubToken = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.workingDirectory = exports.activateEnvironment = exports.pythonVersion = exports.version = void 0;
|
||||
exports.githubToken = exports.serverUrl = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.workingDirectory = exports.activateEnvironment = exports.pythonVersion = exports.version = void 0;
|
||||
const core = __importStar(__nccwpck_require__(37484));
|
||||
const node_path_1 = __importDefault(__nccwpck_require__(76760));
|
||||
exports.version = core.getInput("version");
|
||||
@ -124740,6 +124740,7 @@ exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "tru
|
||||
exports.ignoreEmptyWorkdir = core.getInput("ignore-empty-workdir") === "true";
|
||||
exports.toolBinDir = getToolBinDir();
|
||||
exports.toolDir = getToolDir();
|
||||
exports.serverUrl = getServerUrl();
|
||||
exports.githubToken = core.getInput("github-token");
|
||||
function getEnableCache() {
|
||||
const enableCacheInput = core.getInput("enable-cache");
|
||||
@ -124796,6 +124797,9 @@ function expandTilde(input) {
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function getServerUrl() {
|
||||
return core.getInput("server-url");
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -24,6 +24,7 @@ export function tryGetFromToolCache(
|
||||
}
|
||||
|
||||
export async function downloadVersion(
|
||||
serverUrl: string,
|
||||
platform: Platform,
|
||||
arch: Architecture,
|
||||
version: string,
|
||||
@ -36,7 +37,7 @@ export async function downloadVersion(
|
||||
if (platform === "pc-windows-msvc") {
|
||||
extension = ".zip";
|
||||
}
|
||||
const downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
|
||||
const downloadUrl = `${serverUrl}/${OWNER}/${REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
|
||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||
|
||||
const downloadPath = await tc.downloadTool(
|
||||
|
@ -25,6 +25,7 @@ import {
|
||||
toolDir,
|
||||
version as versionInput,
|
||||
workingDirectory,
|
||||
serverUrl,
|
||||
} from "./utils/inputs";
|
||||
import * as exec from "@actions/exec";
|
||||
import fs from "node:fs";
|
||||
@ -95,6 +96,7 @@ async function setupUv(
|
||||
}
|
||||
|
||||
const downloadVersionResult = await downloadVersion(
|
||||
serverUrl,
|
||||
platform,
|
||||
arch,
|
||||
resolvedVersion,
|
||||
|
@ -17,6 +17,7 @@ export const ignoreEmptyWorkdir =
|
||||
core.getInput("ignore-empty-workdir") === "true";
|
||||
export const toolBinDir = getToolBinDir();
|
||||
export const toolDir = getToolDir();
|
||||
export const serverUrl = getServerUrl();
|
||||
export const githubToken = core.getInput("github-token");
|
||||
|
||||
function getEnableCache(): boolean {
|
||||
@ -84,3 +85,7 @@ function expandTilde(input: string): string {
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
function getServerUrl(): string {
|
||||
return core.getInput("server-url");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user