mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-12 02:56:54 +08:00
Fix error throwing
throw 'error' does not display an error message on GitHub Actions anymore.
This commit is contained in:
12
lib/installer.js
generated
12
lib/installer.js
generated
@@ -38,7 +38,7 @@ function getJuliaVersion(availableReleases, versionInput) {
|
|||||||
// Use the highest available version that matches versionInput
|
// Use the highest available version that matches versionInput
|
||||||
let version = semver.maxSatisfying(availableReleases, versionInput);
|
let version = semver.maxSatisfying(availableReleases, versionInput);
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
throw `Could not find a Julia version that matches ${versionInput}`;
|
throw new Error(`Could not find a Julia version that matches ${versionInput}`);
|
||||||
}
|
}
|
||||||
// GitHub tags start with v, remove it
|
// GitHub tags start with v, remove it
|
||||||
version = version.replace(/^v/, '');
|
version = version.replace(/^v/, '');
|
||||||
@@ -55,7 +55,7 @@ function getDownloadURL(version, arch) {
|
|||||||
}
|
}
|
||||||
else if (osPlat === 'darwin') { // macOS
|
else if (osPlat === 'darwin') { // macOS
|
||||||
if (arch == 'x86') {
|
if (arch == 'x86') {
|
||||||
throw '32-bit Julia is not available on macOS';
|
throw new Error('32-bit Julia is not available on macOS');
|
||||||
}
|
}
|
||||||
platform = 'mac';
|
platform = 'mac';
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ function getDownloadURL(version, arch) {
|
|||||||
platform = 'linux';
|
platform = 'linux';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw `Platform ${osPlat} is not supported`;
|
throw new Error(`Platform ${osPlat} is not supported`);
|
||||||
}
|
}
|
||||||
// nightlies
|
// nightlies
|
||||||
if (version == 'nightly') {
|
if (version == 'nightly') {
|
||||||
@@ -83,7 +83,7 @@ function getFileName(version, arch) {
|
|||||||
}
|
}
|
||||||
else if (osPlat === 'darwin') { // macOS
|
else if (osPlat === 'darwin') { // macOS
|
||||||
if (arch == 'x86') {
|
if (arch == 'x86') {
|
||||||
throw '32-bit Julia is not available on macOS';
|
throw new Error('32-bit Julia is not available on macOS');
|
||||||
}
|
}
|
||||||
versionExt = '-mac64';
|
versionExt = '-mac64';
|
||||||
ext = 'dmg';
|
ext = 'dmg';
|
||||||
@@ -98,7 +98,7 @@ function getFileName(version, arch) {
|
|||||||
ext = 'tar.gz';
|
ext = 'tar.gz';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw `Platform ${osPlat} is not supported`;
|
throw new Error(`Platform ${osPlat} is not supported`);
|
||||||
}
|
}
|
||||||
return `julia-${version}${versionExt}.${ext}`;
|
return `julia-${version}${versionExt}.${ext}`;
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ function installJulia(version, arch) {
|
|||||||
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`]);
|
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`]);
|
||||||
return `${process.env.HOME}/julia`;
|
return `${process.env.HOME}/julia`;
|
||||||
default:
|
default:
|
||||||
throw `Platform ${osPlat} is not supported`;
|
throw new Error(`Platform ${osPlat} is not supported`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export function getJuliaVersion(availableReleases: string[], versionInput: strin
|
|||||||
// Use the highest available version that matches versionInput
|
// Use the highest available version that matches versionInput
|
||||||
let version = semver.maxSatisfying(availableReleases, versionInput)
|
let version = semver.maxSatisfying(availableReleases, versionInput)
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
throw `Could not find a Julia version that matches ${versionInput}`
|
throw new Error(`Could not find a Julia version that matches ${versionInput}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GitHub tags start with v, remove it
|
// GitHub tags start with v, remove it
|
||||||
@@ -48,13 +48,13 @@ function getDownloadURL(version: string, arch: string): string {
|
|||||||
platform = 'winnt'
|
platform = 'winnt'
|
||||||
} else if (osPlat === 'darwin') { // macOS
|
} else if (osPlat === 'darwin') { // macOS
|
||||||
if (arch == 'x86') {
|
if (arch == 'x86') {
|
||||||
throw '32-bit Julia is not available on macOS'
|
throw new Error('32-bit Julia is not available on macOS')
|
||||||
}
|
}
|
||||||
platform = 'mac'
|
platform = 'mac'
|
||||||
} else if (osPlat === 'linux') { // Linux
|
} else if (osPlat === 'linux') { // Linux
|
||||||
platform = 'linux'
|
platform = 'linux'
|
||||||
} else {
|
} else {
|
||||||
throw `Platform ${osPlat} is not supported`
|
throw new Error(`Platform ${osPlat} is not supported`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// nightlies
|
// nightlies
|
||||||
@@ -78,7 +78,7 @@ function getFileName(version: string, arch: string): string {
|
|||||||
ext = 'exe'
|
ext = 'exe'
|
||||||
} else if (osPlat === 'darwin') { // macOS
|
} else if (osPlat === 'darwin') { // macOS
|
||||||
if (arch == 'x86') {
|
if (arch == 'x86') {
|
||||||
throw '32-bit Julia is not available on macOS'
|
throw new Error('32-bit Julia is not available on macOS')
|
||||||
}
|
}
|
||||||
versionExt = '-mac64'
|
versionExt = '-mac64'
|
||||||
ext = 'dmg'
|
ext = 'dmg'
|
||||||
@@ -90,7 +90,7 @@ function getFileName(version: string, arch: string): string {
|
|||||||
}
|
}
|
||||||
ext = 'tar.gz'
|
ext = 'tar.gz'
|
||||||
} else {
|
} else {
|
||||||
throw `Platform ${osPlat} is not supported`
|
throw new Error(`Platform ${osPlat} is not supported`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return `julia-${version}${versionExt}.${ext}`
|
return `julia-${version}${versionExt}.${ext}`
|
||||||
@@ -124,6 +124,6 @@ export async function installJulia(version: string, arch: string): Promise<strin
|
|||||||
await exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`])
|
await exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`])
|
||||||
return `${process.env.HOME}/julia`
|
return `${process.env.HOME}/julia`
|
||||||
default:
|
default:
|
||||||
throw `Platform ${osPlat} is not supported`
|
throw new Error(`Platform ${osPlat} is not supported`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user