mirror of
				https://github.com/astral-sh/setup-uv.git
				synced 2025-10-30 22:46:46 +00:00 
			
		
		
		
	Support OS using musl (#284)
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				test-cache-windows / test-setup-cache (push) Waiting to run
				
			
		
			
				
	
				test-cache-windows / test-restore-cache (push) Blocked by required conditions
				
			
		
			
				
	
				Release Drafter / ✏️ Draft release (push) Failing after 12s
				
			
		
			
				
	
				test-windows / test-default-version (push) Waiting to run
				
			
		
			
				
	
				test-cache / test-setup-cache (auto, ubuntu-latest) (push) Successful in 29s
				
			
		
			
				
	
				test-cache / test-setup-cache (false, ubuntu-latest) (push) Failing after 31s
				
			
		
			
				
	
				test-cache / test-setup-cache (true, ubuntu-latest) (push) Successful in 41s
				
			
		
			
				
	
				test-cache / test-setup-cache-requirements-txt (push) Failing after 31s
				
			
		
			
				
	
				Check dist/ / check-dist (push) Successful in 1m36s
				
			
		
			
				
	
				test-cache / test-no-python-version (push) Failing after 30s
				
			
		
			
				
	
				test-cache / test-setup-cache-dependency-glob (push) Successful in 51s
				
			
		
			
				
	
				test / test-default-version (ubuntu-latest) (push) Failing after 31s
				
			
		
			
				
	
				test / test-specific-version (0.3) (push) Successful in 49s
				
			
		
			
				
	
				test / test-specific-version (0.3.0) (push) Failing after 30s
				
			
		
			
				
	
				test / build (push) Successful in 1m29s
				
			
		
			
				
	
				test / test-specific-version (0.3.2) (push) Failing after 30s
				
			
		
			
				
	
				test / test-semver-range (push) Failing after 4s
				
			
		
			
				
	
				test / test-specific-version (>=0.3.0) (push) Successful in 39s
				
			
		
			
				
	
				test / test-specific-version (0.3.x) (push) Successful in 44s
				
			
		
			
				
	
				test / test-pyproject-file-version (push) Failing after 4s
				
			
		
			
				
	
				test / test-with-explicit-token (push) Failing after 3s
				
			
		
			
				
	
				test / test-uvx (push) Failing after 3s
				
			
		
			
				
	
				test / test-tool-install (ubuntu-latest) (push) Failing after 4s
				
			
		
			
				
	
				test / test-python-version (macos-latest) (push) Failing after 5s
				
			
		
			
				
	
				test / test-uv-file-version (push) Successful in 30s
				
			
		
			
				
	
				test / test-python-version (ubuntu-latest) (push) Failing after 5s
				
			
		
			
				
	
				test / test-malformed-pyproject-file-fallback (push) Failing after 4s
				
			
		
			
				
	
				test / test-checksum (4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd, ubuntu-latest) (push) Successful in 48s
				
			
		
			
				
	
				test / test-musl (push) Failing after 0s
				
			
		
			
				
	
				test-cache / test-restore-cache-dependency-glob (push) Failing after 5s
				
			
		
			
				
	
				test / test-python-version (windows-latest) (push) Successful in 1m17s
				
			
		
			
				
	
				CodeQL / Analyze (TypeScript) (push) Failing after 5m54s
				
			
		
			
				
	
				Update known checksums / build (push) Failing after 21s
				
			
		
			
				
	
				test-cache / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-setup-cache-local (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-tilde-expansion-cache-local-path (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-tilde-expansion-cache-dependency-glob (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-checksum (a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218, 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-cache / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-restore-cache (auto, ubuntu-latest) (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-restore-cache (false, ubuntu-latest) (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-restore-cache (true, ubuntu-latest) (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-restore-cache-requirements-txt (push) Has been cancelled
				
			
		
			
				
	
				test-cache / test-restore-cache-local (push) Has been cancelled
				
			
		
			
				
	
				test-cache / cleanup-tilde-expansion-tests (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	test-cache-windows / test-setup-cache (push) Waiting to run
				
			test-cache-windows / test-restore-cache (push) Blocked by required conditions
				
			Release Drafter / ✏️ Draft release (push) Failing after 12s
				
			test-windows / test-default-version (push) Waiting to run
				
			test-cache / test-setup-cache (auto, ubuntu-latest) (push) Successful in 29s
				
			test-cache / test-setup-cache (false, ubuntu-latest) (push) Failing after 31s
				
			test-cache / test-setup-cache (true, ubuntu-latest) (push) Successful in 41s
				
			test-cache / test-setup-cache-requirements-txt (push) Failing after 31s
				
			Check dist/ / check-dist (push) Successful in 1m36s
				
			test-cache / test-no-python-version (push) Failing after 30s
				
			test-cache / test-setup-cache-dependency-glob (push) Successful in 51s
				
			test / test-default-version (ubuntu-latest) (push) Failing after 31s
				
			test / test-specific-version (0.3) (push) Successful in 49s
				
			test / test-specific-version (0.3.0) (push) Failing after 30s
				
			test / build (push) Successful in 1m29s
				
			test / test-specific-version (0.3.2) (push) Failing after 30s
				
			test / test-semver-range (push) Failing after 4s
				
			test / test-specific-version (>=0.3.0) (push) Successful in 39s
				
			test / test-specific-version (0.3.x) (push) Successful in 44s
				
			test / test-pyproject-file-version (push) Failing after 4s
				
			test / test-with-explicit-token (push) Failing after 3s
				
			test / test-uvx (push) Failing after 3s
				
			test / test-tool-install (ubuntu-latest) (push) Failing after 4s
				
			test / test-python-version (macos-latest) (push) Failing after 5s
				
			test / test-uv-file-version (push) Successful in 30s
				
			test / test-python-version (ubuntu-latest) (push) Failing after 5s
				
			test / test-malformed-pyproject-file-fallback (push) Failing after 4s
				
			test / test-checksum (4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd, ubuntu-latest) (push) Successful in 48s
				
			test / test-musl (push) Failing after 0s
				
			test-cache / test-restore-cache-dependency-glob (push) Failing after 5s
				
			test / test-python-version (windows-latest) (push) Successful in 1m17s
				
			CodeQL / Analyze (TypeScript) (push) Failing after 5m54s
				
			Update known checksums / build (push) Failing after 21s
				
			test-cache / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			test-cache / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			test-cache / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			test-cache / test-setup-cache-local (push) Has been cancelled
				
			test-cache / test-tilde-expansion-cache-local-path (push) Has been cancelled
				
			test-cache / test-tilde-expansion-cache-dependency-glob (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-checksum (a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218, 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-cache / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			test-cache / test-restore-cache (auto, ubuntu-latest) (push) Has been cancelled
				
			test-cache / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			test-cache / test-restore-cache (false, ubuntu-latest) (push) Has been cancelled
				
			test-cache / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
				
			test-cache / test-restore-cache (true, ubuntu-latest) (push) Has been cancelled
				
			test-cache / test-restore-cache-requirements-txt (push) Has been cancelled
				
			test-cache / test-restore-cache-local (push) Has been cancelled
				
			test-cache / cleanup-tilde-expansion-tests (push) Has been cancelled
				
			Fixes: #278
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							bb8d247e1a
						
					
				
				
					commit
					e2e9087257
				
			
							
								
								
									
										11
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							| @@ -200,7 +200,6 @@ jobs: | |||||||
|             exit 1 |             exit 1 | ||||||
|           fi |           fi | ||||||
|         shell: bash |         shell: bash | ||||||
|  |  | ||||||
|   test-malformed-pyproject-file-fallback: |   test-malformed-pyproject-file-fallback: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     steps: |     steps: | ||||||
| @@ -212,3 +211,13 @@ jobs: | |||||||
|           pyproject-file: "__tests__/fixtures/malformed-pyproject-toml-project/pyproject.toml" |           pyproject-file: "__tests__/fixtures/malformed-pyproject-toml-project/pyproject.toml" | ||||||
|       - run: uv sync |       - run: uv sync | ||||||
|         working-directory: __tests__/fixtures/uv-project |         working-directory: __tests__/fixtures/uv-project | ||||||
|  |   test-musl: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     container: alpine | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@v4 | ||||||
|  |       - name: Install latest version | ||||||
|  |         uses: ./ | ||||||
|  |       - run: apk add python3 | ||||||
|  |       - run: uv sync | ||||||
|  |         working-directory: __tests__/fixtures/uv-project | ||||||
|   | |||||||
							
								
								
									
										79
									
								
								dist/save-cache/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										79
									
								
								dist/save-cache/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -91494,7 +91494,8 @@ async function computeKeys() { | |||||||
|     } |     } | ||||||
|     const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : ""; |     const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : ""; | ||||||
|     const pythonVersion = await getPythonVersion(); |     const pythonVersion = await getPythonVersion(); | ||||||
|     return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${pythonVersion}${cacheDependencyPathHash}${suffix}`; |     const platform = await (0, platforms_1.getPlatform)(); | ||||||
|  |     return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${platform}-${pythonVersion}${cacheDependencyPathHash}${suffix}`; | ||||||
| } | } | ||||||
| async function getPythonVersion() { | async function getPythonVersion() { | ||||||
|     if (inputs_1.pythonVersion !== "") { |     if (inputs_1.pythonVersion !== "") { | ||||||
| @@ -91847,13 +91848,48 @@ function expandTilde(input) { | |||||||
| /***/ }), | /***/ }), | ||||||
| 
 | 
 | ||||||
| /***/ 8361: | /***/ 8361: | ||||||
| /***/ ((__unused_webpack_module, exports) => { | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||||||
| 
 | 
 | ||||||
| "use strict"; | "use strict"; | ||||||
| 
 | 
 | ||||||
|  | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||||
|  |     if (k2 === undefined) k2 = k; | ||||||
|  |     var desc = Object.getOwnPropertyDescriptor(m, k); | ||||||
|  |     if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||||||
|  |       desc = { enumerable: true, get: function() { return m[k]; } }; | ||||||
|  |     } | ||||||
|  |     Object.defineProperty(o, k2, desc); | ||||||
|  | }) : (function(o, m, k, k2) { | ||||||
|  |     if (k2 === undefined) k2 = k; | ||||||
|  |     o[k2] = m[k]; | ||||||
|  | })); | ||||||
|  | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||||
|  |     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||||
|  | }) : function(o, v) { | ||||||
|  |     o["default"] = v; | ||||||
|  | }); | ||||||
|  | var __importStar = (this && this.__importStar) || (function () { | ||||||
|  |     var ownKeys = function(o) { | ||||||
|  |         ownKeys = Object.getOwnPropertyNames || function (o) { | ||||||
|  |             var ar = []; | ||||||
|  |             for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||||||
|  |             return ar; | ||||||
|  |         }; | ||||||
|  |         return ownKeys(o); | ||||||
|  |     }; | ||||||
|  |     return function (mod) { | ||||||
|  |         if (mod && mod.__esModule) return mod; | ||||||
|  |         var result = {}; | ||||||
|  |         if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||||||
|  |         __setModuleDefault(result, mod); | ||||||
|  |         return result; | ||||||
|  |     }; | ||||||
|  | })(); | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.getArch = getArch; | exports.getArch = getArch; | ||||||
| exports.getPlatform = getPlatform; | exports.getPlatform = getPlatform; | ||||||
|  | const exec = __importStar(__nccwpck_require__(5236)); | ||||||
|  | const core = __importStar(__nccwpck_require__(7484)); | ||||||
| function getArch() { | function getArch() { | ||||||
|     const arch = process.arch; |     const arch = process.arch; | ||||||
|     const archMapping = { |     const archMapping = { | ||||||
| @@ -91867,15 +91903,46 @@ function getArch() { | |||||||
|         return archMapping[arch]; |         return archMapping[arch]; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| function getPlatform() { | async function getPlatform() { | ||||||
|     const platform = process.platform; |     const processPlatform = process.platform; | ||||||
|     const platformMapping = { |     const platformMapping = { | ||||||
|         linux: "unknown-linux-gnu", |         linux: "unknown-linux-gnu", | ||||||
|         darwin: "apple-darwin", |         darwin: "apple-darwin", | ||||||
|         win32: "pc-windows-msvc", |         win32: "pc-windows-msvc", | ||||||
|     }; |     }; | ||||||
|     if (platform in platformMapping) { |     if (processPlatform in platformMapping) { | ||||||
|         return platformMapping[platform]; |         const platform = platformMapping[processPlatform]; | ||||||
|  |         if (platform === "unknown-linux-gnu") { | ||||||
|  |             const isMusl = await isMuslOs(); | ||||||
|  |             return isMusl ? "unknown-linux-musl" : platform; | ||||||
|  |         } | ||||||
|  |         return platform; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | async function isMuslOs() { | ||||||
|  |     let stdOutput = ""; | ||||||
|  |     let errOutput = ""; | ||||||
|  |     const options = { | ||||||
|  |         silent: !core.isDebug(), | ||||||
|  |         listeners: { | ||||||
|  |             stdout: (data) => { | ||||||
|  |                 stdOutput += data.toString(); | ||||||
|  |             }, | ||||||
|  |             stderr: (data) => { | ||||||
|  |                 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; | ||||||
|  |         core.warning(`Failed to determine glibc or musl. Falling back to glibc. Error: ${err.message}`); | ||||||
|  |         return false; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|   | |||||||
							
								
								
									
										81
									
								
								dist/setup/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										81
									
								
								dist/setup/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -92397,7 +92397,8 @@ async function computeKeys() { | |||||||
|     } |     } | ||||||
|     const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : ""; |     const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : ""; | ||||||
|     const pythonVersion = await getPythonVersion(); |     const pythonVersion = await getPythonVersion(); | ||||||
|     return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${pythonVersion}${cacheDependencyPathHash}${suffix}`; |     const platform = await (0, platforms_1.getPlatform)(); | ||||||
|  |     return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${platform}-${pythonVersion}${cacheDependencyPathHash}${suffix}`; | ||||||
| } | } | ||||||
| async function getPythonVersion() { | async function getPythonVersion() { | ||||||
|     if (inputs_1.pythonVersion !== "") { |     if (inputs_1.pythonVersion !== "") { | ||||||
| @@ -95383,7 +95384,7 @@ const exec = __importStar(__nccwpck_require__(5236)); | |||||||
| const node_fs_1 = __importDefault(__nccwpck_require__(3024)); | const node_fs_1 = __importDefault(__nccwpck_require__(3024)); | ||||||
| const pyproject_1 = __nccwpck_require__(3929); | const pyproject_1 = __nccwpck_require__(3929); | ||||||
| async function run() { | async function run() { | ||||||
|     const platform = (0, platforms_1.getPlatform)(); |     const platform = await (0, platforms_1.getPlatform)(); | ||||||
|     const arch = (0, platforms_1.getArch)(); |     const arch = (0, platforms_1.getArch)(); | ||||||
|     try { |     try { | ||||||
|         if (platform === undefined) { |         if (platform === undefined) { | ||||||
| @@ -95635,13 +95636,48 @@ function expandTilde(input) { | |||||||
| /***/ }), | /***/ }), | ||||||
| 
 | 
 | ||||||
| /***/ 8361: | /***/ 8361: | ||||||
| /***/ ((__unused_webpack_module, exports) => { | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||||||
| 
 | 
 | ||||||
| "use strict"; | "use strict"; | ||||||
| 
 | 
 | ||||||
|  | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||||
|  |     if (k2 === undefined) k2 = k; | ||||||
|  |     var desc = Object.getOwnPropertyDescriptor(m, k); | ||||||
|  |     if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||||||
|  |       desc = { enumerable: true, get: function() { return m[k]; } }; | ||||||
|  |     } | ||||||
|  |     Object.defineProperty(o, k2, desc); | ||||||
|  | }) : (function(o, m, k, k2) { | ||||||
|  |     if (k2 === undefined) k2 = k; | ||||||
|  |     o[k2] = m[k]; | ||||||
|  | })); | ||||||
|  | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||||
|  |     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||||
|  | }) : function(o, v) { | ||||||
|  |     o["default"] = v; | ||||||
|  | }); | ||||||
|  | var __importStar = (this && this.__importStar) || (function () { | ||||||
|  |     var ownKeys = function(o) { | ||||||
|  |         ownKeys = Object.getOwnPropertyNames || function (o) { | ||||||
|  |             var ar = []; | ||||||
|  |             for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||||||
|  |             return ar; | ||||||
|  |         }; | ||||||
|  |         return ownKeys(o); | ||||||
|  |     }; | ||||||
|  |     return function (mod) { | ||||||
|  |         if (mod && mod.__esModule) return mod; | ||||||
|  |         var result = {}; | ||||||
|  |         if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||||||
|  |         __setModuleDefault(result, mod); | ||||||
|  |         return result; | ||||||
|  |     }; | ||||||
|  | })(); | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.getArch = getArch; | exports.getArch = getArch; | ||||||
| exports.getPlatform = getPlatform; | exports.getPlatform = getPlatform; | ||||||
|  | const exec = __importStar(__nccwpck_require__(5236)); | ||||||
|  | const core = __importStar(__nccwpck_require__(7484)); | ||||||
| function getArch() { | function getArch() { | ||||||
|     const arch = process.arch; |     const arch = process.arch; | ||||||
|     const archMapping = { |     const archMapping = { | ||||||
| @@ -95655,15 +95691,46 @@ function getArch() { | |||||||
|         return archMapping[arch]; |         return archMapping[arch]; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| function getPlatform() { | async function getPlatform() { | ||||||
|     const platform = process.platform; |     const processPlatform = process.platform; | ||||||
|     const platformMapping = { |     const platformMapping = { | ||||||
|         linux: "unknown-linux-gnu", |         linux: "unknown-linux-gnu", | ||||||
|         darwin: "apple-darwin", |         darwin: "apple-darwin", | ||||||
|         win32: "pc-windows-msvc", |         win32: "pc-windows-msvc", | ||||||
|     }; |     }; | ||||||
|     if (platform in platformMapping) { |     if (processPlatform in platformMapping) { | ||||||
|         return platformMapping[platform]; |         const platform = platformMapping[processPlatform]; | ||||||
|  |         if (platform === "unknown-linux-gnu") { | ||||||
|  |             const isMusl = await isMuslOs(); | ||||||
|  |             return isMusl ? "unknown-linux-musl" : platform; | ||||||
|  |         } | ||||||
|  |         return platform; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | async function isMuslOs() { | ||||||
|  |     let stdOutput = ""; | ||||||
|  |     let errOutput = ""; | ||||||
|  |     const options = { | ||||||
|  |         silent: !core.isDebug(), | ||||||
|  |         listeners: { | ||||||
|  |             stdout: (data) => { | ||||||
|  |                 stdOutput += data.toString(); | ||||||
|  |             }, | ||||||
|  |             stderr: (data) => { | ||||||
|  |                 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; | ||||||
|  |         core.warning(`Failed to determine glibc or musl. Falling back to glibc. Error: ${err.message}`); | ||||||
|  |         return false; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|   | |||||||
							
								
								
									
										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 suffix = cacheSuffix ? `-${cacheSuffix}` : ""; | ||||||
|   const pythonVersion = await getPythonVersion(); |   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> { | async function getPythonVersion(): Promise<string> { | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ import fs from "node:fs"; | |||||||
| import { getUvVersionFromConfigFile } from "./utils/pyproject"; | import { getUvVersionFromConfigFile } from "./utils/pyproject"; | ||||||
|  |  | ||||||
| async function run(): Promise<void> { | async function run(): Promise<void> { | ||||||
|   const platform = getPlatform(); |   const platform = await getPlatform(); | ||||||
|   const arch = getArch(); |   const arch = getArch(); | ||||||
|  |  | ||||||
|   try { |   try { | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | import * as exec from "@actions/exec"; | ||||||
|  | import * as core from "@actions/core"; | ||||||
| export type Platform = | export type Platform = | ||||||
|   | "unknown-linux-gnu" |   | "unknown-linux-gnu" | ||||||
|   | "unknown-linux-musl" |   | "unknown-linux-musl" | ||||||
| @@ -26,15 +28,49 @@ export function getArch(): Architecture | undefined { | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| export function getPlatform(): Platform | undefined { | export async function getPlatform(): Promise<Platform | undefined> { | ||||||
|   const platform = process.platform; |   const processPlatform = process.platform; | ||||||
|   const platformMapping: { [key: string]: Platform } = { |   const platformMapping: { [key: string]: Platform } = { | ||||||
|     linux: "unknown-linux-gnu", |     linux: "unknown-linux-gnu", | ||||||
|     darwin: "apple-darwin", |     darwin: "apple-darwin", | ||||||
|     win32: "pc-windows-msvc", |     win32: "pc-windows-msvc", | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   if (platform in platformMapping) { |   if (processPlatform in platformMapping) { | ||||||
|     return platformMapping[platform]; |     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; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user