Support musl.

This commit is contained in:
Miles Johnson 2023-08-01 14:56:40 -07:00
parent ff53ffe218
commit f15a249d24
4 changed files with 32 additions and 4 deletions

View file

@ -1,3 +1,7 @@
# 1.0.0
- Added musl support to `cargo-binstall`.
# 0.6.0
- Breaking: Cargo `bins` must provide the `cargo-` crate prefix manually. This change allows

View file

@ -22,7 +22,8 @@
"@actions/glob": "^0.4.0",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1",
"@ltd/j-toml": "^1.38.0"
"@ltd/j-toml": "^1.38.0",
"detect-libc": "^2.0.2"
},
"devDependencies": {
"@types/node": "^18.15.11",

8
pnpm-lock.yaml generated
View file

@ -22,6 +22,9 @@ dependencies:
'@ltd/j-toml':
specifier: ^1.38.0
version: 1.38.0
detect-libc:
specifier: ^2.0.2
version: 2.0.2
devDependencies:
'@types/node':
@ -933,6 +936,11 @@ packages:
engines: {node: '>=6'}
dev: true
/detect-libc@2.0.2:
resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==}
engines: {node: '>=8'}
dev: false
/dir-glob@3.0.1:
resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
engines: {node: '>=8'}

View file

@ -26,6 +26,9 @@ export async function downloadAndInstallBinstall(binDir: string) {
case 'x64':
arch = 'x86_64';
break;
case 'arm':
arch = 'armv7';
break;
case 'arm64':
arch = 'aarch64';
break;
@ -34,9 +37,21 @@ export async function downloadAndInstallBinstall(binDir: string) {
}
switch (process.platform) {
case 'linux':
file = `${arch}-unknown-linux-gnu.tgz`;
case 'linux': {
const { family } = await import('detect-libc');
let lib = 'gnu';
if ((await family()) === 'musl') {
lib = 'musl';
}
if (process.arch === 'arm') {
lib += 'eabihf';
}
file = `${arch}-unknown-linux-${lib}.tgz`;
break;
}
case 'darwin':
file = `${arch}-apple-darwin.zip`;
break;
@ -220,7 +235,7 @@ export async function restoreCache() {
core.saveState('cache-hit-key', cacheKey);
core.info(`Cache restored using key ${primaryKey}`);
} else {
core.warning(`Cache does not exist using key ${primaryKey}`);
core.info(`Cache does not exist using key ${primaryKey}`);
}
core.setOutput('cache-key', cacheKey ?? primaryKey);