mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-02-24 04:50:09 +08:00
Cache musl setup in GitHub tool-cache.
This commit is contained in:
parent
66dc2bf069
commit
a02f4df8f7
27
dist/index.js
generated
vendored
27
dist/index.js
generated
vendored
@ -134,27 +134,28 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||||||
const tc = __importStar(__nccwpck_require__(7784));
|
const tc = __importStar(__nccwpck_require__(7784));
|
||||||
const constants_1 = __nccwpck_require__(5105);
|
const constants_1 = __nccwpck_require__(5105);
|
||||||
const exec_1 = __nccwpck_require__(1514);
|
const exec_1 = __nccwpck_require__(1514);
|
||||||
const os_1 = __nccwpck_require__(2037);
|
|
||||||
const path_1 = __nccwpck_require__(1017);
|
const path_1 = __nccwpck_require__(1017);
|
||||||
const io_1 = __nccwpck_require__(7436);
|
const MUSL_NAME = 'x86_64-linux-musl-native';
|
||||||
|
const MUSL_VERSION = '10.2.1';
|
||||||
function setUpNativeImageMusl() {
|
function setUpNativeImageMusl() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (!constants_1.IS_LINUX) {
|
if (!constants_1.IS_LINUX) {
|
||||||
core.warning('musl is only supported on Linux');
|
core.warning('musl is only supported on Linux');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let toolPath = tc.find(MUSL_NAME, MUSL_VERSION);
|
||||||
|
if (toolPath) {
|
||||||
|
core.info(`Found ${MUSL_NAME} ${MUSL_VERSION} in tool-cache @ ${toolPath}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
core.startGroup(`Setting up musl for GraalVM Native Image...`);
|
core.startGroup(`Setting up musl for GraalVM Native Image...`);
|
||||||
const basePath = (0, path_1.join)((0, os_1.homedir)(), '.musl_feature');
|
const muslDownloadPath = yield tc.downloadTool(`http://more.musl.cc/10/x86_64-linux-musl/${MUSL_NAME}.tgz`);
|
||||||
yield (0, io_1.mkdirP)(basePath);
|
const muslExtractPath = yield tc.extractTar(muslDownloadPath);
|
||||||
const muslName = 'x86_64-linux-musl-native';
|
const muslPath = (0, path_1.join)(muslExtractPath, MUSL_NAME);
|
||||||
const muslDownloadPath = yield tc.downloadTool(`http://more.musl.cc/10/x86_64-linux-musl/${muslName}.tgz`);
|
|
||||||
yield tc.extractTar(muslDownloadPath, basePath);
|
|
||||||
const muslPath = (0, path_1.join)(basePath, muslName);
|
|
||||||
core.addPath((0, path_1.join)(muslPath, 'bin'));
|
|
||||||
const zlibVersion = '1.2.11';
|
const zlibVersion = '1.2.11';
|
||||||
const zlibDownloadPath = yield tc.downloadTool(`https://zlib.net/zlib-${zlibVersion}.tar.gz`);
|
const zlibDownloadPath = yield tc.downloadTool(`https://zlib.net/zlib-${zlibVersion}.tar.gz`);
|
||||||
yield tc.extractTar(zlibDownloadPath, basePath);
|
const zlibExtractPath = yield tc.extractTar(zlibDownloadPath);
|
||||||
const zlibPath = (0, path_1.join)(basePath, `zlib-${zlibVersion}`);
|
const zlibPath = (0, path_1.join)(zlibExtractPath, `zlib-${zlibVersion}`);
|
||||||
const zlibBuildOptions = {
|
const zlibBuildOptions = {
|
||||||
cwd: zlibPath,
|
cwd: zlibPath,
|
||||||
env: Object.assign(Object.assign({}, process.env), { CC: (0, path_1.join)(muslPath, 'bin', 'gcc') })
|
env: Object.assign(Object.assign({}, process.env), { CC: (0, path_1.join)(muslPath, 'bin', 'gcc') })
|
||||||
@ -162,7 +163,11 @@ function setUpNativeImageMusl() {
|
|||||||
yield (0, exec_1.exec)('./configure', [`--prefix=${muslPath}`, '--static'], zlibBuildOptions);
|
yield (0, exec_1.exec)('./configure', [`--prefix=${muslPath}`, '--static'], zlibBuildOptions);
|
||||||
yield (0, exec_1.exec)('make', [], zlibBuildOptions);
|
yield (0, exec_1.exec)('make', [], zlibBuildOptions);
|
||||||
yield (0, exec_1.exec)('make', ['install'], { cwd: zlibPath });
|
yield (0, exec_1.exec)('make', ['install'], { cwd: zlibPath });
|
||||||
|
core.info(`Adding ${MUSL_NAME} ${MUSL_VERSION} to tool-cache ...`);
|
||||||
|
toolPath = yield tc.cacheDir(muslPath, MUSL_NAME, MUSL_VERSION);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
|
}
|
||||||
|
core.addPath((0, path_1.join)(toolPath, 'bin'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.setUpNativeImageMusl = setUpNativeImageMusl;
|
exports.setUpNativeImageMusl = setUpNativeImageMusl;
|
||||||
|
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
@ -2,33 +2,33 @@ import * as core from '@actions/core'
|
|||||||
import * as tc from '@actions/tool-cache'
|
import * as tc from '@actions/tool-cache'
|
||||||
import {IS_LINUX} from './constants'
|
import {IS_LINUX} from './constants'
|
||||||
import {exec} from '@actions/exec'
|
import {exec} from '@actions/exec'
|
||||||
import {homedir} from 'os'
|
|
||||||
import {join} from 'path'
|
import {join} from 'path'
|
||||||
import {mkdirP} from '@actions/io'
|
|
||||||
|
const MUSL_NAME = 'x86_64-linux-musl-native'
|
||||||
|
const MUSL_VERSION = '10.2.1'
|
||||||
|
|
||||||
export async function setUpNativeImageMusl(): Promise<void> {
|
export async function setUpNativeImageMusl(): Promise<void> {
|
||||||
if (!IS_LINUX) {
|
if (!IS_LINUX) {
|
||||||
core.warning('musl is only supported on Linux')
|
core.warning('musl is only supported on Linux')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
let toolPath = tc.find(MUSL_NAME, MUSL_VERSION)
|
||||||
|
if (toolPath) {
|
||||||
|
core.info(`Found ${MUSL_NAME} ${MUSL_VERSION} in tool-cache @ ${toolPath}`)
|
||||||
|
} else {
|
||||||
core.startGroup(`Setting up musl for GraalVM Native Image...`)
|
core.startGroup(`Setting up musl for GraalVM Native Image...`)
|
||||||
const basePath = join(homedir(), '.musl_feature')
|
|
||||||
await mkdirP(basePath)
|
|
||||||
|
|
||||||
const muslName = 'x86_64-linux-musl-native'
|
|
||||||
const muslDownloadPath = await tc.downloadTool(
|
const muslDownloadPath = await tc.downloadTool(
|
||||||
`http://more.musl.cc/10/x86_64-linux-musl/${muslName}.tgz`
|
`http://more.musl.cc/10/x86_64-linux-musl/${MUSL_NAME}.tgz`
|
||||||
)
|
)
|
||||||
await tc.extractTar(muslDownloadPath, basePath)
|
const muslExtractPath = await tc.extractTar(muslDownloadPath)
|
||||||
const muslPath = join(basePath, muslName)
|
const muslPath = join(muslExtractPath, MUSL_NAME)
|
||||||
core.addPath(join(muslPath, 'bin'))
|
|
||||||
|
|
||||||
const zlibVersion = '1.2.11'
|
const zlibVersion = '1.2.11'
|
||||||
const zlibDownloadPath = await tc.downloadTool(
|
const zlibDownloadPath = await tc.downloadTool(
|
||||||
`https://zlib.net/zlib-${zlibVersion}.tar.gz`
|
`https://zlib.net/zlib-${zlibVersion}.tar.gz`
|
||||||
)
|
)
|
||||||
await tc.extractTar(zlibDownloadPath, basePath)
|
const zlibExtractPath = await tc.extractTar(zlibDownloadPath)
|
||||||
const zlibPath = join(basePath, `zlib-${zlibVersion}`)
|
const zlibPath = join(zlibExtractPath, `zlib-${zlibVersion}`)
|
||||||
const zlibBuildOptions = {
|
const zlibBuildOptions = {
|
||||||
cwd: zlibPath,
|
cwd: zlibPath,
|
||||||
env: {
|
env: {
|
||||||
@ -43,5 +43,10 @@ export async function setUpNativeImageMusl(): Promise<void> {
|
|||||||
)
|
)
|
||||||
await exec('make', [], zlibBuildOptions)
|
await exec('make', [], zlibBuildOptions)
|
||||||
await exec('make', ['install'], {cwd: zlibPath})
|
await exec('make', ['install'], {cwd: zlibPath})
|
||||||
|
|
||||||
|
core.info(`Adding ${MUSL_NAME} ${MUSL_VERSION} to tool-cache ...`)
|
||||||
|
toolPath = await tc.cacheDir(muslPath, MUSL_NAME, MUSL_VERSION)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
}
|
}
|
||||||
|
core.addPath(join(toolPath, 'bin'))
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user