mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-07-27 16:21:42 +00:00
interpret relative inputs as under working-directory (#498)
Some checks failed
test / lint (push) Failing after 2s
test / test-specific-version (0.3.0) (push) Failing after 2s
test / test-specific-version (>=0.3.0) (push) Failing after 2s
test / test-pyproject-file-version (push) Failing after 1s
test / test-version-file-version (push) Failing after 1s
test / test-uvx (push) Failing after 1s
test / test-activate-environment (ubuntu-latest) (push) Failing after 1s
test / test-setup-cache (false, ubuntu-latest) (push) Failing after 1s
test / test-setup-cache-dependency-glob (push) Failing after 1s
test / test-restore-cache-dependency-glob (push) Has been skipped
test / test-custom-manifest-file (push) Failing after 1s
test / test-default-version (ubuntu-latest) (push) Successful in 41s
test / test-specific-version (0.3.2) (push) Successful in 54s
test / test-semver-range (ubuntu-latest) (push) Successful in 54s
test / test-specific-version (0.3.x) (push) Successful in 1m3s
test / test-musl (push) Failing after 1m16s
test / test-uv-file-version (push) Successful in 1m22s
test / test-malformed-pyproject-file-fallback (push) Successful in 1m23s
test / test-cache-local (map[expected-cache-dir:/home/runner/work/_temp/setup-uv-cache os:ubuntu-latest]) (push) Failing after 1m20s
test / test-pep440-version (push) Successful in 1m31s
test / test-checksum (map[checksum:4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd os:ubuntu-latest]) (push) Successful in 1m34s
test / test-absolute-path (push) Successful in 1m27s
test / test-tool-install (ubuntu-latest) (push) Successful in 1m47s
CodeQL / Analyze (TypeScript) (push) Failing after 2m9s
test / test-setup-cache (true, ubuntu-latest) (push) Successful in 2m10s
test / test-setup-cache-requirements-txt (push) Successful in 2m30s
test / test-with-explicit-token (push) Successful in 2m54s
test / test-specific-version (0.3) (push) Successful in 3m16s
test / test-setup-cache (auto, ubuntu-latest) (push) Successful in 3m16s
test / test-no-python-version (push) Successful in 4m36s
test / test-python-version (ubuntu-latest) (push) Failing after 9m37s
Release Drafter / ✏️ Draft release (push) Has been cancelled
test / test-tilde-expansion-cache-local-path (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-default-version (macos-14) (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-restore-cache (auto, 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-requirements-txt (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-dependency-glob (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 (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-local (push) Has been cancelled
test / cleanup-tilde-expansion-tests (push) Has been cancelled
test / all-tests-passed (push) Has been cancelled
Some checks failed
test / lint (push) Failing after 2s
test / test-specific-version (0.3.0) (push) Failing after 2s
test / test-specific-version (>=0.3.0) (push) Failing after 2s
test / test-pyproject-file-version (push) Failing after 1s
test / test-version-file-version (push) Failing after 1s
test / test-uvx (push) Failing after 1s
test / test-activate-environment (ubuntu-latest) (push) Failing after 1s
test / test-setup-cache (false, ubuntu-latest) (push) Failing after 1s
test / test-setup-cache-dependency-glob (push) Failing after 1s
test / test-restore-cache-dependency-glob (push) Has been skipped
test / test-custom-manifest-file (push) Failing after 1s
test / test-default-version (ubuntu-latest) (push) Successful in 41s
test / test-specific-version (0.3.2) (push) Successful in 54s
test / test-semver-range (ubuntu-latest) (push) Successful in 54s
test / test-specific-version (0.3.x) (push) Successful in 1m3s
test / test-musl (push) Failing after 1m16s
test / test-uv-file-version (push) Successful in 1m22s
test / test-malformed-pyproject-file-fallback (push) Successful in 1m23s
test / test-cache-local (map[expected-cache-dir:/home/runner/work/_temp/setup-uv-cache os:ubuntu-latest]) (push) Failing after 1m20s
test / test-pep440-version (push) Successful in 1m31s
test / test-checksum (map[checksum:4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd os:ubuntu-latest]) (push) Successful in 1m34s
test / test-absolute-path (push) Successful in 1m27s
test / test-tool-install (ubuntu-latest) (push) Successful in 1m47s
CodeQL / Analyze (TypeScript) (push) Failing after 2m9s
test / test-setup-cache (true, ubuntu-latest) (push) Successful in 2m10s
test / test-setup-cache-requirements-txt (push) Successful in 2m30s
test / test-with-explicit-token (push) Successful in 2m54s
test / test-specific-version (0.3) (push) Successful in 3m16s
test / test-setup-cache (auto, ubuntu-latest) (push) Successful in 3m16s
test / test-no-python-version (push) Successful in 4m36s
test / test-python-version (ubuntu-latest) (push) Failing after 9m37s
Release Drafter / ✏️ Draft release (push) Has been cancelled
test / test-tilde-expansion-cache-local-path (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-default-version (macos-14) (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-restore-cache (auto, 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-requirements-txt (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-dependency-glob (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 (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-local (push) Has been cancelled
test / cleanup-tilde-expansion-tests (push) Has been cancelled
test / all-tests-passed (push) Has been cancelled
Fixes: #441
This commit is contained in:
committed by
GitHub
parent
23482a31a8
commit
2c7142f755
19
.github/workflows/test.yml
vendored
19
.github/workflows/test.yml
vendored
@ -566,6 +566,24 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
test-absolute-path:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Create requirements.txt
|
||||||
|
run: echo "uv==0.6.17" > /tmp/setup-uv-requirements.txt
|
||||||
|
- name: Install from requirements file
|
||||||
|
id: setup-uv
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version-file: "/tmp/setup-uv-requirements.txt"
|
||||||
|
- name: Correct version gets installed
|
||||||
|
run: |
|
||||||
|
if [ "$(uv --version)" != "uv 0.6.17" ]; then
|
||||||
|
echo "Wrong uv version: $(uv --version)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
all-tests-passed:
|
all-tests-passed:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
@ -600,6 +618,7 @@ jobs:
|
|||||||
- cleanup-tilde-expansion-tests
|
- cleanup-tilde-expansion-tests
|
||||||
- test-no-python-version
|
- test-no-python-version
|
||||||
- test-custom-manifest-file
|
- test-custom-manifest-file
|
||||||
|
- test-absolute-path
|
||||||
if: always()
|
if: always()
|
||||||
steps:
|
steps:
|
||||||
- name: All tests passed
|
- name: All tests passed
|
||||||
|
31
dist/save-cache/index.js
generated
vendored
31
dist/save-cache/index.js
generated
vendored
@ -89010,7 +89010,7 @@ exports.checkSum = core.getInput("checksum");
|
|||||||
exports.enableCache = getEnableCache();
|
exports.enableCache = getEnableCache();
|
||||||
exports.cacheSuffix = core.getInput("cache-suffix") || "";
|
exports.cacheSuffix = core.getInput("cache-suffix") || "";
|
||||||
exports.cacheLocalPath = getCacheLocalPath();
|
exports.cacheLocalPath = getCacheLocalPath();
|
||||||
exports.cacheDependencyGlob = core.getInput("cache-dependency-glob");
|
exports.cacheDependencyGlob = getCacheDependencyGlob();
|
||||||
exports.pruneCache = core.getInput("prune-cache") === "true";
|
exports.pruneCache = core.getInput("prune-cache") === "true";
|
||||||
exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "true";
|
exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "true";
|
||||||
exports.ignoreEmptyWorkdir = core.getInput("ignore-empty-workdir") === "true";
|
exports.ignoreEmptyWorkdir = core.getInput("ignore-empty-workdir") === "true";
|
||||||
@ -89029,7 +89029,8 @@ function getEnableCache() {
|
|||||||
function getToolBinDir() {
|
function getToolBinDir() {
|
||||||
const toolBinDirInput = core.getInput("tool-bin-dir");
|
const toolBinDirInput = core.getInput("tool-bin-dir");
|
||||||
if (toolBinDirInput !== "") {
|
if (toolBinDirInput !== "") {
|
||||||
return expandTilde(toolBinDirInput);
|
const tildeExpanded = expandTilde(toolBinDirInput);
|
||||||
|
return resolveRelativePath(tildeExpanded);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@ -89042,7 +89043,8 @@ function getToolBinDir() {
|
|||||||
function getToolDir() {
|
function getToolDir() {
|
||||||
const toolDirInput = core.getInput("tool-dir");
|
const toolDirInput = core.getInput("tool-dir");
|
||||||
if (toolDirInput !== "") {
|
if (toolDirInput !== "") {
|
||||||
return expandTilde(toolDirInput);
|
const tildeExpanded = expandTilde(toolDirInput);
|
||||||
|
return resolveRelativePath(tildeExpanded);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@ -89055,7 +89057,8 @@ function getToolDir() {
|
|||||||
function getCacheLocalPath() {
|
function getCacheLocalPath() {
|
||||||
const cacheLocalPathInput = core.getInput("cache-local-path");
|
const cacheLocalPathInput = core.getInput("cache-local-path");
|
||||||
if (cacheLocalPathInput !== "") {
|
if (cacheLocalPathInput !== "") {
|
||||||
return expandTilde(cacheLocalPathInput);
|
const tildeExpanded = expandTilde(cacheLocalPathInput);
|
||||||
|
return resolveRelativePath(tildeExpanded);
|
||||||
}
|
}
|
||||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@ -89068,12 +89071,32 @@ function getCacheLocalPath() {
|
|||||||
}
|
}
|
||||||
return `${process.env.HOME}${node_path_1.default.sep}.cache${node_path_1.default.sep}uv`;
|
return `${process.env.HOME}${node_path_1.default.sep}.cache${node_path_1.default.sep}uv`;
|
||||||
}
|
}
|
||||||
|
function getCacheDependencyGlob() {
|
||||||
|
const cacheDependencyGlobInput = core.getInput("cache-dependency-glob");
|
||||||
|
if (cacheDependencyGlobInput !== "") {
|
||||||
|
return cacheDependencyGlobInput
|
||||||
|
.split("\n")
|
||||||
|
.map((part) => part.trim())
|
||||||
|
.map((part) => expandTilde(part))
|
||||||
|
.map((part) => resolveRelativePath(part))
|
||||||
|
.join("\n");
|
||||||
|
}
|
||||||
|
return cacheDependencyGlobInput;
|
||||||
|
}
|
||||||
function expandTilde(input) {
|
function expandTilde(input) {
|
||||||
if (input.startsWith("~")) {
|
if (input.startsWith("~")) {
|
||||||
return `${process.env.HOME}${input.substring(1)}`;
|
return `${process.env.HOME}${input.substring(1)}`;
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
function resolveRelativePath(inputPath) {
|
||||||
|
if (node_path_1.default.isAbsolute(inputPath)) {
|
||||||
|
return inputPath;
|
||||||
|
}
|
||||||
|
const absolutePath = `${exports.workingDirectory}${node_path_1.default.sep}${inputPath}`;
|
||||||
|
core.debug(`Resolving relative path ${inputPath} to ${absolutePath}`);
|
||||||
|
return absolutePath;
|
||||||
|
}
|
||||||
function getManifestFile() {
|
function getManifestFile() {
|
||||||
const manifestFileInput = core.getInput("manifest-file");
|
const manifestFileInput = core.getInput("manifest-file");
|
||||||
if (manifestFileInput !== "") {
|
if (manifestFileInput !== "") {
|
||||||
|
31
dist/setup/index.js
generated
vendored
31
dist/setup/index.js
generated
vendored
@ -125534,7 +125534,7 @@ exports.checkSum = core.getInput("checksum");
|
|||||||
exports.enableCache = getEnableCache();
|
exports.enableCache = getEnableCache();
|
||||||
exports.cacheSuffix = core.getInput("cache-suffix") || "";
|
exports.cacheSuffix = core.getInput("cache-suffix") || "";
|
||||||
exports.cacheLocalPath = getCacheLocalPath();
|
exports.cacheLocalPath = getCacheLocalPath();
|
||||||
exports.cacheDependencyGlob = core.getInput("cache-dependency-glob");
|
exports.cacheDependencyGlob = getCacheDependencyGlob();
|
||||||
exports.pruneCache = core.getInput("prune-cache") === "true";
|
exports.pruneCache = core.getInput("prune-cache") === "true";
|
||||||
exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "true";
|
exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "true";
|
||||||
exports.ignoreEmptyWorkdir = core.getInput("ignore-empty-workdir") === "true";
|
exports.ignoreEmptyWorkdir = core.getInput("ignore-empty-workdir") === "true";
|
||||||
@ -125553,7 +125553,8 @@ function getEnableCache() {
|
|||||||
function getToolBinDir() {
|
function getToolBinDir() {
|
||||||
const toolBinDirInput = core.getInput("tool-bin-dir");
|
const toolBinDirInput = core.getInput("tool-bin-dir");
|
||||||
if (toolBinDirInput !== "") {
|
if (toolBinDirInput !== "") {
|
||||||
return expandTilde(toolBinDirInput);
|
const tildeExpanded = expandTilde(toolBinDirInput);
|
||||||
|
return resolveRelativePath(tildeExpanded);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@ -125566,7 +125567,8 @@ function getToolBinDir() {
|
|||||||
function getToolDir() {
|
function getToolDir() {
|
||||||
const toolDirInput = core.getInput("tool-dir");
|
const toolDirInput = core.getInput("tool-dir");
|
||||||
if (toolDirInput !== "") {
|
if (toolDirInput !== "") {
|
||||||
return expandTilde(toolDirInput);
|
const tildeExpanded = expandTilde(toolDirInput);
|
||||||
|
return resolveRelativePath(tildeExpanded);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@ -125579,7 +125581,8 @@ function getToolDir() {
|
|||||||
function getCacheLocalPath() {
|
function getCacheLocalPath() {
|
||||||
const cacheLocalPathInput = core.getInput("cache-local-path");
|
const cacheLocalPathInput = core.getInput("cache-local-path");
|
||||||
if (cacheLocalPathInput !== "") {
|
if (cacheLocalPathInput !== "") {
|
||||||
return expandTilde(cacheLocalPathInput);
|
const tildeExpanded = expandTilde(cacheLocalPathInput);
|
||||||
|
return resolveRelativePath(tildeExpanded);
|
||||||
}
|
}
|
||||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@ -125592,12 +125595,32 @@ function getCacheLocalPath() {
|
|||||||
}
|
}
|
||||||
return `${process.env.HOME}${node_path_1.default.sep}.cache${node_path_1.default.sep}uv`;
|
return `${process.env.HOME}${node_path_1.default.sep}.cache${node_path_1.default.sep}uv`;
|
||||||
}
|
}
|
||||||
|
function getCacheDependencyGlob() {
|
||||||
|
const cacheDependencyGlobInput = core.getInput("cache-dependency-glob");
|
||||||
|
if (cacheDependencyGlobInput !== "") {
|
||||||
|
return cacheDependencyGlobInput
|
||||||
|
.split("\n")
|
||||||
|
.map((part) => part.trim())
|
||||||
|
.map((part) => expandTilde(part))
|
||||||
|
.map((part) => resolveRelativePath(part))
|
||||||
|
.join("\n");
|
||||||
|
}
|
||||||
|
return cacheDependencyGlobInput;
|
||||||
|
}
|
||||||
function expandTilde(input) {
|
function expandTilde(input) {
|
||||||
if (input.startsWith("~")) {
|
if (input.startsWith("~")) {
|
||||||
return `${process.env.HOME}${input.substring(1)}`;
|
return `${process.env.HOME}${input.substring(1)}`;
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
function resolveRelativePath(inputPath) {
|
||||||
|
if (node_path_1.default.isAbsolute(inputPath)) {
|
||||||
|
return inputPath;
|
||||||
|
}
|
||||||
|
const absolutePath = `${exports.workingDirectory}${node_path_1.default.sep}${inputPath}`;
|
||||||
|
core.debug(`Resolving relative path ${inputPath} to ${absolutePath}`);
|
||||||
|
return absolutePath;
|
||||||
|
}
|
||||||
function getManifestFile() {
|
function getManifestFile() {
|
||||||
const manifestFileInput = core.getInput("manifest-file");
|
const manifestFileInput = core.getInput("manifest-file");
|
||||||
if (manifestFileInput !== "") {
|
if (manifestFileInput !== "") {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { getManifestFromRepo } from "@actions/tool-cache";
|
|
||||||
|
|
||||||
export const version = core.getInput("version");
|
export const version = core.getInput("version");
|
||||||
export const versionFile = core.getInput("version-file");
|
export const versionFile = core.getInput("version-file");
|
||||||
@ -11,7 +10,7 @@ export const checkSum = core.getInput("checksum");
|
|||||||
export const enableCache = getEnableCache();
|
export const enableCache = getEnableCache();
|
||||||
export const cacheSuffix = core.getInput("cache-suffix") || "";
|
export const cacheSuffix = core.getInput("cache-suffix") || "";
|
||||||
export const cacheLocalPath = getCacheLocalPath();
|
export const cacheLocalPath = getCacheLocalPath();
|
||||||
export const cacheDependencyGlob = core.getInput("cache-dependency-glob");
|
export const cacheDependencyGlob = getCacheDependencyGlob();
|
||||||
export const pruneCache = core.getInput("prune-cache") === "true";
|
export const pruneCache = core.getInput("prune-cache") === "true";
|
||||||
export const ignoreNothingToCache =
|
export const ignoreNothingToCache =
|
||||||
core.getInput("ignore-nothing-to-cache") === "true";
|
core.getInput("ignore-nothing-to-cache") === "true";
|
||||||
@ -34,7 +33,8 @@ function getEnableCache(): boolean {
|
|||||||
function getToolBinDir(): string | undefined {
|
function getToolBinDir(): string | undefined {
|
||||||
const toolBinDirInput = core.getInput("tool-bin-dir");
|
const toolBinDirInput = core.getInput("tool-bin-dir");
|
||||||
if (toolBinDirInput !== "") {
|
if (toolBinDirInput !== "") {
|
||||||
return expandTilde(toolBinDirInput);
|
const tildeExpanded = expandTilde(toolBinDirInput);
|
||||||
|
return resolveRelativePath(tildeExpanded);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@ -50,7 +50,8 @@ function getToolBinDir(): string | undefined {
|
|||||||
function getToolDir(): string | undefined {
|
function getToolDir(): string | undefined {
|
||||||
const toolDirInput = core.getInput("tool-dir");
|
const toolDirInput = core.getInput("tool-dir");
|
||||||
if (toolDirInput !== "") {
|
if (toolDirInput !== "") {
|
||||||
return expandTilde(toolDirInput);
|
const tildeExpanded = expandTilde(toolDirInput);
|
||||||
|
return resolveRelativePath(tildeExpanded);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@ -66,7 +67,8 @@ function getToolDir(): string | undefined {
|
|||||||
function getCacheLocalPath(): string {
|
function getCacheLocalPath(): string {
|
||||||
const cacheLocalPathInput = core.getInput("cache-local-path");
|
const cacheLocalPathInput = core.getInput("cache-local-path");
|
||||||
if (cacheLocalPathInput !== "") {
|
if (cacheLocalPathInput !== "") {
|
||||||
return expandTilde(cacheLocalPathInput);
|
const tildeExpanded = expandTilde(cacheLocalPathInput);
|
||||||
|
return resolveRelativePath(tildeExpanded);
|
||||||
}
|
}
|
||||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@ -82,6 +84,19 @@ function getCacheLocalPath(): string {
|
|||||||
return `${process.env.HOME}${path.sep}.cache${path.sep}uv`;
|
return `${process.env.HOME}${path.sep}.cache${path.sep}uv`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCacheDependencyGlob(): string {
|
||||||
|
const cacheDependencyGlobInput = core.getInput("cache-dependency-glob");
|
||||||
|
if (cacheDependencyGlobInput !== "") {
|
||||||
|
return cacheDependencyGlobInput
|
||||||
|
.split("\n")
|
||||||
|
.map((part) => part.trim())
|
||||||
|
.map((part) => expandTilde(part))
|
||||||
|
.map((part) => resolveRelativePath(part))
|
||||||
|
.join("\n");
|
||||||
|
}
|
||||||
|
return cacheDependencyGlobInput;
|
||||||
|
}
|
||||||
|
|
||||||
function expandTilde(input: string): string {
|
function expandTilde(input: string): string {
|
||||||
if (input.startsWith("~")) {
|
if (input.startsWith("~")) {
|
||||||
return `${process.env.HOME}${input.substring(1)}`;
|
return `${process.env.HOME}${input.substring(1)}`;
|
||||||
@ -89,6 +104,15 @@ function expandTilde(input: string): string {
|
|||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolveRelativePath(inputPath: string): string {
|
||||||
|
if (path.isAbsolute(inputPath)) {
|
||||||
|
return inputPath;
|
||||||
|
}
|
||||||
|
const absolutePath = `${workingDirectory}${path.sep}${inputPath}`;
|
||||||
|
core.debug(`Resolving relative path ${inputPath} to ${absolutePath}`);
|
||||||
|
return absolutePath;
|
||||||
|
}
|
||||||
|
|
||||||
function getManifestFile(): string | undefined {
|
function getManifestFile(): string | undefined {
|
||||||
const manifestFileInput = core.getInput("manifest-file");
|
const manifestFileInput = core.getInput("manifest-file");
|
||||||
if (manifestFileInput !== "") {
|
if (manifestFileInput !== "") {
|
||||||
|
Reference in New Issue
Block a user