Support 32-bit Julia binaries

This commit is contained in:
Sascha Mann
2019-08-21 15:34:52 +02:00
parent 6f01df9c38
commit a7c1edc063
3 changed files with 42 additions and 30 deletions

View File

@@ -26,39 +26,42 @@ core.debug(`platform: ${osPlat}`);
function getMajorMinorVersion(version) {
return version.split('.').slice(0, 2).join('.');
}
function getDownloadURL(version) {
function getDownloadURL(version, arch) {
const baseURL = 'https://julialang-s3.julialang.org/bin';
let platform, arch;
let platform;
const versionDir = getMajorMinorVersion(version);
if (osPlat === 'win32') { // Windows
platform = 'winnt';
arch = 'x64';
}
else if (osPlat === 'darwin') { // macOS
if (arch == 'x86') {
throw '32-bit Julia is not available on macOS';
}
platform = 'mac';
arch = 'x64';
}
else if (osPlat === 'linux') { // Linux
platform = 'linux';
arch = 'x64';
}
else {
throw `Platform ${osPlat} is not supported`;
}
return `${baseURL}/${platform}/${arch}/${versionDir}/${getFileName(version)}`;
return `${baseURL}/${platform}/${arch}/${versionDir}/${getFileName(version, arch)}`;
}
function getFileName(version) {
function getFileName(version, arch) {
let versionExt, ext;
if (osPlat === 'win32') { // Windows
versionExt = '-win64';
versionExt = arch == 'x64' ? '-win64' : '-win32';
ext = 'exe';
}
else if (osPlat === 'darwin') { // macOS
if (arch == 'x86') {
throw '32-bit Julia is not available on macOS';
}
versionExt = '-mac64';
ext = 'dmg';
}
else if (osPlat === 'linux') { // Linux
versionExt = '-linux-x86_64';
versionExt = arch == 'x64' ? '-linux-x86_64' : '-linux-i686';
ext = 'tar.gz';
}
else {
@@ -66,10 +69,10 @@ function getFileName(version) {
}
return `julia-${version}${versionExt}.${ext}`;
}
function installJulia(version) {
function installJulia(version, arch) {
return __awaiter(this, void 0, void 0, function* () {
// Download Julia
const downloadURL = getDownloadURL(version);
const downloadURL = getDownloadURL(version, arch);
core.debug(`downloading Julia from ${downloadURL}`);
const juliaDownloadPath = yield tc.downloadTool(downloadURL);
// Install it
@@ -93,15 +96,16 @@ function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const version = core.getInput('version');
core.debug(`selected Julia version: ${version}`);
const arch = core.getInput('arch');
core.debug(`selected Julia version: ${arch}/${version}`);
// Search in cache
let juliaPath;
juliaPath = tc.find('julia', version);
juliaPath = tc.find('julia', version, arch);
if (!juliaPath) {
core.debug(`could not find Julia ${version} in cache`);
const juliaInstallationPath = yield installJulia(version);
const juliaInstallationPath = yield installJulia(version, arch);
// Add it to cache
juliaPath = yield tc.cacheDir(juliaInstallationPath, 'julia', version);
juliaPath = yield tc.cacheDir(juliaInstallationPath, 'julia', version, arch);
core.debug(`added Julia to cache: ${juliaPath}`);
}
else {