feat: auto install libtinfo5
This commit is contained in:
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@@ -53,11 +53,6 @@ jobs:
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install libtinfo5
|
||||
run:
|
||||
add-apt-repository universe && apt update -y && apt install -y
|
||||
libtinfo5
|
||||
|
||||
- name: Test Local Action
|
||||
id: test-action
|
||||
uses: ./
|
||||
|
||||
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 17.64%"><title>Coverage: 17.64%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">17.64%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">17.64%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 15.29%"><title>Coverage: 15.29%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">15.29%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">15.29%</text></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
28
dist/index.js
generated
vendored
28
dist/index.js
generated
vendored
@@ -28287,6 +28287,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.download = download;
|
||||
exports.downloadRequirements = downloadRequirements;
|
||||
exports.getLatestVersion = getLatestVersion;
|
||||
const tc = __importStar(__nccwpck_require__(3472));
|
||||
const core = __importStar(__nccwpck_require__(7484));
|
||||
@@ -28336,6 +28337,29 @@ async function download(version) {
|
||||
const cachedPath = await tc.cacheDir(`/tmp/clang-${version}`, 'clang', version);
|
||||
return cachedPath;
|
||||
}
|
||||
async function downloadRequirements() {
|
||||
if (process.platform == 'linux') {
|
||||
const url = 'http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.2-0ubuntu2.1_amd64.deb';
|
||||
core.info(`Downloading libtinfo5 (${process.platform}, ${process.arch}) from ${url} ...`);
|
||||
const archivePath = await tc.downloadTool(url);
|
||||
core.info(`Extracting libtinfo5 archive...`);
|
||||
let exit = await exec.exec('mkdir', ['-p', `/tmp/libtinfo5_6.2`]);
|
||||
if (exit !== 0) {
|
||||
throw new Error(`Failed to create directory /tmp/libtinfo5_6.2`);
|
||||
}
|
||||
exit = await exec.exec('dpkg-deb', [
|
||||
'-xv',
|
||||
archivePath,
|
||||
'/tmp/libtinfo5_6.2'
|
||||
]);
|
||||
if (exit !== 0) {
|
||||
throw new Error(`Failed to extract libtinfo5`);
|
||||
}
|
||||
const cachedPath = await tc.cacheDir(`/tmp/libtinfo5_6.2`, 'libtinfo5', '6.2');
|
||||
return cachedPath;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
async function getLatestVersion() {
|
||||
const http = new httpm.HttpClient('siteorg/setup-clang');
|
||||
const url = 'https://api.github.com/repos/llvm/llvm-project/releases';
|
||||
@@ -28403,12 +28427,14 @@ async function run() {
|
||||
clangVersion = await (0, download_1.getLatestVersion)();
|
||||
}
|
||||
const downloadPath = await (0, download_1.download)(clangVersion);
|
||||
const downloadRequirementsPath = await (0, download_1.downloadRequirements)();
|
||||
const bin = path.join(downloadPath, 'bin');
|
||||
const lib = path.join(downloadPath, 'lib');
|
||||
const requirementsLib = path.join(downloadRequirementsPath, 'lib');
|
||||
core.addPath(bin);
|
||||
core.exportVariable('LLVM_PATH', downloadPath);
|
||||
const ld = process.env.LD_LIBRARY_PATH ?? '';
|
||||
core.exportVariable('LD_LIBRARY_PATH', `${lib}${path.delimiter}${ld}`);
|
||||
core.exportVariable('LD_LIBRARY_PATH', `${requirementsLib}${path.delimiter}${lib}${path.delimiter}${ld}`);
|
||||
// Ensure system libraries are first on ARM64 macOS to avoid issues with Apple's libc++ being weird.
|
||||
// https://discourse.llvm.org/t/apples-libc-now-provides-std-type-descriptor-t-functionality-not-found-in-upstream-libc/73881/5
|
||||
const dyld = process.env.DYLD_LIBRARY_PATH;
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -70,6 +70,47 @@ export async function download(version: string): Promise<string> {
|
||||
return cachedPath
|
||||
}
|
||||
|
||||
export async function downloadRequirements(): Promise<string> {
|
||||
if (process.platform == 'linux') {
|
||||
const url =
|
||||
'http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.2-0ubuntu2.1_amd64.deb'
|
||||
|
||||
core.info(
|
||||
`Downloading libtinfo5 (${process.platform}, ${process.arch}) from ${url} ...`
|
||||
)
|
||||
|
||||
const archivePath = await tc.downloadTool(url)
|
||||
|
||||
core.info(`Extracting libtinfo5 archive...`)
|
||||
|
||||
let exit = await exec.exec('mkdir', ['-p', `/tmp/libtinfo5_6.2`])
|
||||
|
||||
if (exit !== 0) {
|
||||
throw new Error(`Failed to create directory /tmp/libtinfo5_6.2`)
|
||||
}
|
||||
|
||||
exit = await exec.exec('dpkg-deb', [
|
||||
'-xv',
|
||||
archivePath,
|
||||
'/tmp/libtinfo5_6.2'
|
||||
])
|
||||
|
||||
if (exit !== 0) {
|
||||
throw new Error(`Failed to extract libtinfo5`)
|
||||
}
|
||||
|
||||
const cachedPath = await tc.cacheDir(
|
||||
`/tmp/libtinfo5_6.2`,
|
||||
'libtinfo5',
|
||||
'6.2'
|
||||
)
|
||||
|
||||
return cachedPath
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
export async function getLatestVersion(): Promise<string> {
|
||||
const http = new httpm.HttpClient('siteorg/setup-clang')
|
||||
const url = 'https://api.github.com/repos/llvm/llvm-project/releases'
|
||||
|
||||
11
src/main.ts
11
src/main.ts
@@ -1,5 +1,5 @@
|
||||
import * as core from '@actions/core'
|
||||
import { download, getLatestVersion } from './download'
|
||||
import { download, downloadRequirements, getLatestVersion } from './download'
|
||||
import * as path from 'path'
|
||||
|
||||
/**
|
||||
@@ -15,14 +15,21 @@ export async function run(): Promise<void> {
|
||||
}
|
||||
|
||||
const downloadPath = await download(clangVersion)
|
||||
const downloadRequirementsPath = await downloadRequirements()
|
||||
|
||||
const bin = path.join(downloadPath, 'bin')
|
||||
const lib = path.join(downloadPath, 'lib')
|
||||
|
||||
const requirementsLib = path.join(downloadRequirementsPath, 'lib')
|
||||
|
||||
core.addPath(bin)
|
||||
core.exportVariable('LLVM_PATH', downloadPath)
|
||||
|
||||
const ld = process.env.LD_LIBRARY_PATH ?? ''
|
||||
core.exportVariable('LD_LIBRARY_PATH', `${lib}${path.delimiter}${ld}`)
|
||||
core.exportVariable(
|
||||
'LD_LIBRARY_PATH',
|
||||
`${requirementsLib}${path.delimiter}${lib}${path.delimiter}${ld}`
|
||||
)
|
||||
|
||||
// Ensure system libraries are first on ARM64 macOS to avoid issues with Apple's libc++ being weird.
|
||||
// https://discourse.llvm.org/t/apples-libc-now-provides-std-type-descriptor-t-functionality-not-found-in-upstream-libc/73881/5
|
||||
|
||||
Reference in New Issue
Block a user