mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-05-17 06:34:45 +00:00
Support OS using musl (#284)
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-pyproject-file-version (push) Waiting to run
test / test-uv-file-version (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 (macos-latest) (push) Waiting to run
test / test-python-version (ubuntu-latest) (push) Waiting to run
test / test-python-version (windows-latest) (push) Waiting to run
test / test-malformed-pyproject-file-fallback (push) Waiting to run
test / test-musl (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-pyproject-file-version (push) Waiting to run
test / test-uv-file-version (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 (macos-latest) (push) Waiting to run
test / test-python-version (ubuntu-latest) (push) Waiting to run
test / test-python-version (windows-latest) (push) Waiting to run
test / test-malformed-pyproject-file-fallback (push) Waiting to run
test / test-musl (push) Waiting to run
Fixes: #278
This commit is contained in:
parent
bb8d247e1a
commit
e2e9087257
6 changed files with 200 additions and 20 deletions
3
src/cache/restore-cache.ts
vendored
3
src/cache/restore-cache.ts
vendored
|
@ -53,7 +53,8 @@ async function computeKeys(): Promise<string> {
|
|||
}
|
||||
const suffix = cacheSuffix ? `-${cacheSuffix}` : "";
|
||||
const pythonVersion = await getPythonVersion();
|
||||
return `setup-uv-${CACHE_VERSION}-${getArch()}-${getPlatform()}-${pythonVersion}${cacheDependencyPathHash}${suffix}`;
|
||||
const platform = await getPlatform();
|
||||
return `setup-uv-${CACHE_VERSION}-${getArch()}-${platform}-${pythonVersion}${cacheDependencyPathHash}${suffix}`;
|
||||
}
|
||||
|
||||
async function getPythonVersion(): Promise<string> {
|
||||
|
|
|
@ -30,7 +30,7 @@ import fs from "node:fs";
|
|||
import { getUvVersionFromConfigFile } from "./utils/pyproject";
|
||||
|
||||
async function run(): Promise<void> {
|
||||
const platform = getPlatform();
|
||||
const platform = await getPlatform();
|
||||
const arch = getArch();
|
||||
|
||||
try {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import * as exec from "@actions/exec";
|
||||
import * as core from "@actions/core";
|
||||
export type Platform =
|
||||
| "unknown-linux-gnu"
|
||||
| "unknown-linux-musl"
|
||||
|
@ -26,15 +28,49 @@ export function getArch(): Architecture | undefined {
|
|||
}
|
||||
}
|
||||
|
||||
export function getPlatform(): Platform | undefined {
|
||||
const platform = process.platform;
|
||||
export async function getPlatform(): Promise<Platform | undefined> {
|
||||
const processPlatform = process.platform;
|
||||
const platformMapping: { [key: string]: Platform } = {
|
||||
linux: "unknown-linux-gnu",
|
||||
darwin: "apple-darwin",
|
||||
win32: "pc-windows-msvc",
|
||||
};
|
||||
|
||||
if (platform in platformMapping) {
|
||||
return platformMapping[platform];
|
||||
if (processPlatform in platformMapping) {
|
||||
const platform = platformMapping[processPlatform];
|
||||
if (platform === "unknown-linux-gnu") {
|
||||
const isMusl = await isMuslOs();
|
||||
return isMusl ? "unknown-linux-musl" : platform;
|
||||
}
|
||||
return platform;
|
||||
}
|
||||
}
|
||||
|
||||
async function isMuslOs(): Promise<boolean> {
|
||||
let stdOutput = "";
|
||||
let errOutput = "";
|
||||
const options: exec.ExecOptions = {
|
||||
silent: !core.isDebug(),
|
||||
listeners: {
|
||||
stdout: (data: Buffer) => {
|
||||
stdOutput += data.toString();
|
||||
},
|
||||
stderr: (data: Buffer) => {
|
||||
errOutput += data.toString();
|
||||
},
|
||||
},
|
||||
ignoreReturnCode: true,
|
||||
};
|
||||
|
||||
try {
|
||||
const execArgs = ["--version"];
|
||||
await exec.exec("ldd", execArgs, options);
|
||||
return stdOutput.includes("musl") || errOutput.includes("musl");
|
||||
} catch (error) {
|
||||
const err = error as Error;
|
||||
core.warning(
|
||||
`Failed to determine glibc or musl. Falling back to glibc. Error: ${err.message}`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue