mirror astral-sh/setup-uv @ d0cc045d04ccac9d8b7881df0226f9e82c39688e
CodeQL / Analyze (TypeScript) (push) Failing after 1s
test / lint (push) Failing after 1s
test / test-default-version (ubuntu-latest) (push) Failing after 0s
test / test-specific-version (0.3) (push) Failing after 0s
test / test-specific-version (0.3.0) (push) Failing after 1s
test / test-specific-version (0.3.2) (push) Failing after 0s
test / test-specific-version (0.3.x) (push) Failing after 0s
test / test-specific-version (>=0.3.0) (push) Failing after 1s
test / test-semver-range (ubuntu-latest) (push) Failing after 1s
test / test-pep440-version (push) Failing after 0s
test / test-pyproject-file-version (push) Failing after 0s
test / test-malformed-pyproject-file-fallback (push) Failing after 0s
test / test-version-file-version (push) Failing after 0s
test / test-uv-file-version (push) Failing after 0s
test / test-version-file-hash-version (push) Failing after 0s
test / test-tool-versions-file-version (push) Failing after 0s
test / test-checksum (map[checksum:4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd os:ubuntu-latest]) (push) Failing after 1s
test / test-with-explicit-token (push) Failing after 0s
test / test-uvx (push) Failing after 1s
test / test-tool-install (ubuntu-latest) (push) Failing after 0s
test / test-python-version (ubuntu-latest) (push) Failing after 0s
test / test-activate-environment (ubuntu-latest) (push) Failing after 0s
test / test-setup-cache (auto, ubuntu-latest) (push) Failing after 0s
test / test-musl (push) Failing after 0s
test / test-setup-cache (true, ubuntu-latest) (push) Failing after 0s
test / test-setup-cache-requirements-txt (push) Failing after 0s
test / test-setup-cache (false, ubuntu-latest) (push) Failing after 0s
test / test-restore-cache-requirements-txt (push) Skipped
test / test-setup-cache-save-cache-false (push) Failing after 0s
test / test-setup-cache-dependency-glob (push) Failing after 0s
test / test-restore-cache-dependency-glob (push) Skipped
test / test-restore-cache-save-cache-false (push) Skipped
test / test-cache-local (map[expected-cache-dir:/home/runner/work/_temp/setup-uv-cache os:ubuntu-latest]) (push) Failing after 1s
test / test-setup-cache-restore-cache-false (push) Failing after 0s
test / test-restore-cache-restore-cache-false (push) Skipped
test / test-no-python-version (push) Failing after 0s
test / test-absolute-path (push) Failing after 0s
test / test-custom-manifest-file (push) Failing after 0s
test / test-relative-path (push) Failing after 0s
test / test-default-version (macos-14) (push) Canceled after 0s
test / test-default-version (macos-latest) (push) Canceled after 0s
test / test-default-version (windows-latest) (push) Canceled after 0s
test / test-semver-range (selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-checksum (map[checksum:a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218 os:macos-latest]) (push) Canceled after 0s
test / test-tool-install (macos-14) (push) Canceled after 0s
test / test-tool-install (macos-latest) (push) Canceled after 0s
test / test-tool-install (windows-latest) (push) Canceled after 0s
test / test-tilde-expansion-tool-dirs (push) Canceled after 0s
test / test-python-version (macos-latest) (push) Canceled after 0s
test / test-python-version (windows-latest) (push) Canceled after 0s
test / test-activate-environment (macos-latest) (push) Canceled after 0s
test / test-activate-environment (windows-latest) (push) Canceled after 0s
test / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-setup-cache (auto, windows-latest) (push) Canceled after 0s
test / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-setup-cache (false, windows-latest) (push) Canceled after 0s
test / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-setup-cache (true, windows-latest) (push) Canceled after 0s
test / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-restore-cache (auto, ubuntu-latest) (push) Canceled after 0s
test / test-restore-cache (auto, windows-latest) (push) Canceled after 0s
test / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-restore-cache (false, ubuntu-latest) (push) Canceled after 0s
test / test-restore-cache (false, windows-latest) (push) Canceled after 0s
test / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-restore-cache (true, ubuntu-latest) (push) Canceled after 0s
test / test-restore-cache (true, windows-latest) (push) Canceled after 0s
test / test-cache-local (map[expected-cache-dir:/home/ubuntu/.cache/uv os:selfhosted-ubuntu-arm64]) (push) Canceled after 0s
test / test-cache-local (map[expected-cache-dir:D:\a\_temp\setup-uv-cache os:windows-latest]) (push) Canceled after 0s
test / test-setup-cache-local (push) Canceled after 0s
test / test-restore-cache-local (push) Canceled after 0s
test / test-tilde-expansion-cache-local-path (push) Canceled after 0s
test / test-tilde-expansion-cache-dependency-glob (push) Canceled after 0s
test / cleanup-tilde-expansion-tests (push) Canceled after 0s
test / all-tests-passed (push) Canceled after 0s
Release Drafter / ✏️ Draft release (push) Canceled after 0s
CodeQL / Analyze (TypeScript) (push) Failing after 1s
test / lint (push) Failing after 1s
test / test-default-version (ubuntu-latest) (push) Failing after 0s
test / test-specific-version (0.3) (push) Failing after 0s
test / test-specific-version (0.3.0) (push) Failing after 1s
test / test-specific-version (0.3.2) (push) Failing after 0s
test / test-specific-version (0.3.x) (push) Failing after 0s
test / test-specific-version (>=0.3.0) (push) Failing after 1s
test / test-semver-range (ubuntu-latest) (push) Failing after 1s
test / test-pep440-version (push) Failing after 0s
test / test-pyproject-file-version (push) Failing after 0s
test / test-malformed-pyproject-file-fallback (push) Failing after 0s
test / test-version-file-version (push) Failing after 0s
test / test-uv-file-version (push) Failing after 0s
test / test-version-file-hash-version (push) Failing after 0s
test / test-tool-versions-file-version (push) Failing after 0s
test / test-checksum (map[checksum:4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd os:ubuntu-latest]) (push) Failing after 1s
test / test-with-explicit-token (push) Failing after 0s
test / test-uvx (push) Failing after 1s
test / test-tool-install (ubuntu-latest) (push) Failing after 0s
test / test-python-version (ubuntu-latest) (push) Failing after 0s
test / test-activate-environment (ubuntu-latest) (push) Failing after 0s
test / test-setup-cache (auto, ubuntu-latest) (push) Failing after 0s
test / test-musl (push) Failing after 0s
test / test-setup-cache (true, ubuntu-latest) (push) Failing after 0s
test / test-setup-cache-requirements-txt (push) Failing after 0s
test / test-setup-cache (false, ubuntu-latest) (push) Failing after 0s
test / test-restore-cache-requirements-txt (push) Skipped
test / test-setup-cache-save-cache-false (push) Failing after 0s
test / test-setup-cache-dependency-glob (push) Failing after 0s
test / test-restore-cache-dependency-glob (push) Skipped
test / test-restore-cache-save-cache-false (push) Skipped
test / test-cache-local (map[expected-cache-dir:/home/runner/work/_temp/setup-uv-cache os:ubuntu-latest]) (push) Failing after 1s
test / test-setup-cache-restore-cache-false (push) Failing after 0s
test / test-restore-cache-restore-cache-false (push) Skipped
test / test-no-python-version (push) Failing after 0s
test / test-absolute-path (push) Failing after 0s
test / test-custom-manifest-file (push) Failing after 0s
test / test-relative-path (push) Failing after 0s
test / test-default-version (macos-14) (push) Canceled after 0s
test / test-default-version (macos-latest) (push) Canceled after 0s
test / test-default-version (windows-latest) (push) Canceled after 0s
test / test-semver-range (selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-checksum (map[checksum:a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218 os:macos-latest]) (push) Canceled after 0s
test / test-tool-install (macos-14) (push) Canceled after 0s
test / test-tool-install (macos-latest) (push) Canceled after 0s
test / test-tool-install (windows-latest) (push) Canceled after 0s
test / test-tilde-expansion-tool-dirs (push) Canceled after 0s
test / test-python-version (macos-latest) (push) Canceled after 0s
test / test-python-version (windows-latest) (push) Canceled after 0s
test / test-activate-environment (macos-latest) (push) Canceled after 0s
test / test-activate-environment (windows-latest) (push) Canceled after 0s
test / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-setup-cache (auto, windows-latest) (push) Canceled after 0s
test / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-setup-cache (false, windows-latest) (push) Canceled after 0s
test / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-setup-cache (true, windows-latest) (push) Canceled after 0s
test / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-restore-cache (auto, ubuntu-latest) (push) Canceled after 0s
test / test-restore-cache (auto, windows-latest) (push) Canceled after 0s
test / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-restore-cache (false, ubuntu-latest) (push) Canceled after 0s
test / test-restore-cache (false, windows-latest) (push) Canceled after 0s
test / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Canceled after 0s
test / test-restore-cache (true, ubuntu-latest) (push) Canceled after 0s
test / test-restore-cache (true, windows-latest) (push) Canceled after 0s
test / test-cache-local (map[expected-cache-dir:/home/ubuntu/.cache/uv os:selfhosted-ubuntu-arm64]) (push) Canceled after 0s
test / test-cache-local (map[expected-cache-dir:D:\a\_temp\setup-uv-cache os:windows-latest]) (push) Canceled after 0s
test / test-setup-cache-local (push) Canceled after 0s
test / test-restore-cache-local (push) Canceled after 0s
test / test-tilde-expansion-cache-local-path (push) Canceled after 0s
test / test-tilde-expansion-cache-dependency-glob (push) Canceled after 0s
test / cleanup-tilde-expansion-tests (push) Canceled after 0s
test / all-tests-passed (push) Canceled after 0s
Release Drafter / ✏️ Draft release (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
jest.mock("@actions/core", () => {
|
||||
return {
|
||||
debug: jest.fn(),
|
||||
getBooleanInput: jest.fn(
|
||||
(name: string) => (mockInputs[name] ?? "") === "true",
|
||||
),
|
||||
getInput: jest.fn((name: string) => mockInputs[name] ?? ""),
|
||||
};
|
||||
});
|
||||
|
||||
import {
|
||||
afterEach,
|
||||
beforeEach,
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
jest,
|
||||
} from "@jest/globals";
|
||||
|
||||
// Will be mutated per test before (re-)importing the module under test
|
||||
let mockInputs: Record<string, string> = {};
|
||||
const ORIGINAL_HOME = process.env.HOME;
|
||||
|
||||
describe("cacheDependencyGlob", () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
mockInputs = {};
|
||||
process.env.HOME = "/home/testuser";
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env.HOME = ORIGINAL_HOME;
|
||||
});
|
||||
|
||||
it("returns empty string when input not provided", async () => {
|
||||
mockInputs["working-directory"] = "/workspace";
|
||||
const { cacheDependencyGlob } = await import("../../src/utils/inputs");
|
||||
expect(cacheDependencyGlob).toBe("");
|
||||
});
|
||||
|
||||
it("resolves a single relative path", async () => {
|
||||
mockInputs["working-directory"] = "/workspace";
|
||||
mockInputs["cache-dependency-glob"] = "requirements.txt";
|
||||
const { cacheDependencyGlob } = await import("../../src/utils/inputs");
|
||||
expect(cacheDependencyGlob).toBe("/workspace/requirements.txt");
|
||||
});
|
||||
|
||||
it("strips leading ./ from relative path", async () => {
|
||||
mockInputs["working-directory"] = "/workspace";
|
||||
mockInputs["cache-dependency-glob"] = "./uv.lock";
|
||||
const { cacheDependencyGlob } = await import("../../src/utils/inputs");
|
||||
expect(cacheDependencyGlob).toBe("/workspace/uv.lock");
|
||||
});
|
||||
|
||||
it("handles multiple lines, trimming whitespace, tilde expansion and absolute paths", async () => {
|
||||
mockInputs["working-directory"] = "/workspace";
|
||||
mockInputs["cache-dependency-glob"] =
|
||||
" ~/.cache/file1\n ./rel/file2 \nfile3.txt";
|
||||
const { cacheDependencyGlob } = await import("../../src/utils/inputs");
|
||||
expect(cacheDependencyGlob).toBe(
|
||||
[
|
||||
"/home/testuser/.cache/file1", // expanded tilde, absolute path unchanged
|
||||
"/workspace/rel/file2", // ./ stripped and resolved
|
||||
"/workspace/file3.txt", // relative path resolved
|
||||
].join("\n"),
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps absolute path unchanged in multiline input", async () => {
|
||||
mockInputs["working-directory"] = "/workspace";
|
||||
mockInputs["cache-dependency-glob"] = "/abs/path.lock\nrelative.lock";
|
||||
const { cacheDependencyGlob } = await import("../../src/utils/inputs");
|
||||
expect(cacheDependencyGlob).toBe(
|
||||
["/abs/path.lock", "/workspace/relative.lock"].join("\n"),
|
||||
);
|
||||
});
|
||||
|
||||
it("handles exclusions in relative paths correct", async () => {
|
||||
mockInputs["working-directory"] = "/workspace";
|
||||
mockInputs["cache-dependency-glob"] = "!/abs/path.lock\n!relative.lock";
|
||||
const { cacheDependencyGlob } = await import("../../src/utils/inputs");
|
||||
expect(cacheDependencyGlob).toBe(
|
||||
["!/abs/path.lock", "!/workspace/relative.lock"].join("\n"),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user