mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-12 11:06:53 +08:00
Throw an informative error for non-existent version (#86)
* Throw an informative error for non-existent version * npm install && npm run build
This commit is contained in:
6
lib/installer.js
generated
6
lib/installer.js
generated
@@ -124,15 +124,19 @@ function getNightlyFileName(arch) {
|
|||||||
return `julia-latest${versionExt}.${ext}`;
|
return `julia-latest${versionExt}.${ext}`;
|
||||||
}
|
}
|
||||||
function getFileInfo(versionInfo, version, arch) {
|
function getFileInfo(versionInfo, version, arch) {
|
||||||
|
const err = `Could not find ${archMap[arch]}/${version} binaries`;
|
||||||
if (version.endsWith('nightly')) {
|
if (version.endsWith('nightly')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (!versionInfo[version]) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
for (let file of versionInfo[version].files) {
|
for (let file of versionInfo[version].files) {
|
||||||
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
|
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw `Could not find ${archMap[arch]}/${version} binaries`;
|
throw err;
|
||||||
}
|
}
|
||||||
exports.getFileInfo = getFileInfo;
|
exports.getFileInfo = getFileInfo;
|
||||||
function getDownloadURL(fileInfo, version, arch) {
|
function getDownloadURL(fileInfo, version, arch) {
|
||||||
|
|||||||
8522
package-lock.json
generated
8522
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-julia",
|
"name": "setup-julia",
|
||||||
"version": "1.6.0",
|
"version": "1.6.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "setup Julia action",
|
"description": "setup Julia action",
|
||||||
"main": "lib/setup-julia.js",
|
"main": "lib/setup-julia.js",
|
||||||
|
|||||||
@@ -115,17 +115,23 @@ function getNightlyFileName(arch: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getFileInfo(versionInfo, version: string, arch: string) {
|
export function getFileInfo(versionInfo, version: string, arch: string) {
|
||||||
|
const err = `Could not find ${archMap[arch]}/${version} binaries`
|
||||||
|
|
||||||
if (version.endsWith('nightly')) {
|
if (version.endsWith('nightly')) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!versionInfo[version]) {
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
|
||||||
for (let file of versionInfo[version].files) {
|
for (let file of versionInfo[version].files) {
|
||||||
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
|
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
|
||||||
return file
|
return file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw `Could not find ${archMap[arch]}/${version} binaries`
|
throw err
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDownloadURL(fileInfo, version: string, arch: string): string {
|
export function getDownloadURL(fileInfo, version: string, arch: string): string {
|
||||||
@@ -204,12 +210,12 @@ export async function installJulia(versionInfo, version: string, arch: string):
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if Julia has been installed and print the version.
|
* Test if Julia has been installed and print the version.
|
||||||
*
|
*
|
||||||
* true => always show versioninfo
|
* true => always show versioninfo
|
||||||
* false => only show on nightlies
|
* false => only show on nightlies
|
||||||
* never => never show it anywhere
|
* never => never show it anywhere
|
||||||
*
|
*
|
||||||
* @param showVersionInfoInput
|
* @param showVersionInfoInput
|
||||||
*/
|
*/
|
||||||
export async function showVersionInfo(showVersionInfoInput: string, version: string): Promise<void> {
|
export async function showVersionInfo(showVersionInfoInput: string, version: string): Promise<void> {
|
||||||
// --compile=min -O0 reduces the time from ~1.8-1.9s to ~0.8-0.9s
|
// --compile=min -O0 reduces the time from ~1.8-1.9s to ~0.8-0.9s
|
||||||
@@ -219,7 +225,7 @@ export async function showVersionInfo(showVersionInfoInput: string, version: str
|
|||||||
case 'true':
|
case 'true':
|
||||||
exitCode = await exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])
|
exitCode = await exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'false':
|
case 'false':
|
||||||
if (version.endsWith('nightly')) {
|
if (version.endsWith('nightly')) {
|
||||||
exitCode = await exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])
|
exitCode = await exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])
|
||||||
@@ -227,7 +233,7 @@ export async function showVersionInfo(showVersionInfoInput: string, version: str
|
|||||||
exitCode = await exec.exec('julia', ['--version'])
|
exitCode = await exec.exec('julia', ['--version'])
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'never':
|
case 'never':
|
||||||
exitCode = await exec.exec('julia', ['--version'])
|
exitCode = await exec.exec('julia', ['--version'])
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user