mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-12 19:16:54 +08:00
Compare commits
1 Commits
releases/v
...
releases/v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94873876a2 |
7
.github/dependabot.yml
vendored
7
.github/dependabot.yml
vendored
@@ -1,7 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: gitsubmodule
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
8
.github/workflows/example-builds-nightly.yml
vendored
8
.github/workflows/example-builds-nightly.yml
vendored
@@ -2,7 +2,6 @@ name: Example builds (nightly)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main', 'master', 'releases/*']
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '37 17 * * *'
|
||||
@@ -13,7 +12,6 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
julia-version: [nightly, 1.8-nightly]
|
||||
julia-arch: [x64, x86]
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
# 32-bit Julia binaries are not available on macOS
|
||||
@@ -30,10 +28,10 @@ jobs:
|
||||
npm run build
|
||||
npm run pack
|
||||
|
||||
- name: "Set up Julia (${{ matrix.julia-version }})"
|
||||
- name: "Set up Julia (nightly)"
|
||||
uses: ./
|
||||
with:
|
||||
version: ${{ matrix.julia-version }}
|
||||
version: nightly
|
||||
arch: ${{ matrix.julia-arch }}
|
||||
show-versioninfo: 'true'
|
||||
- run: julia --version
|
||||
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
|
||||
|
||||
8
.github/workflows/example-builds.yml
vendored
8
.github/workflows/example-builds.yml
vendored
@@ -1,10 +1,6 @@
|
||||
name: Example builds
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main', 'master', 'releases/*']
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -35,5 +31,5 @@ jobs:
|
||||
with:
|
||||
version: ${{ matrix.julia-version }}
|
||||
arch: ${{ matrix.julia-arch }}
|
||||
show-versioninfo: 'true'
|
||||
- run: julia --version
|
||||
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
|
||||
|
||||
39
README.md
39
README.md
@@ -1,6 +1,5 @@
|
||||
# setup-julia Action
|
||||
|
||||
[](https://securitylab.github.com/tools/codeql)
|
||||
[](https://dependabot.com)
|
||||
|
||||
This action sets up a Julia environment for use in actions by downloading a specified version of Julia and adding it to PATH.
|
||||
@@ -38,27 +37,13 @@ This action sets up a Julia environment for use in actions by downloading a spec
|
||||
|
||||
# The architecture of the Julia binaries.
|
||||
#
|
||||
# Please note that installing aarch64 binaries only makes sense on self-hosted aarch64 runners.
|
||||
# We currently don't run test builds on that architecture, so we cannot guarantee that the input won't break randomly,
|
||||
# although there is no reason why it would.
|
||||
#
|
||||
# Supported values: x64 | x86 | aarch64 (untested)
|
||||
# Supported values: x64 | x86
|
||||
#
|
||||
# Default: x64
|
||||
arch: ''
|
||||
|
||||
# Set the display setting for printing InteractiveUtils.versioninfo() after installing.
|
||||
#
|
||||
# Starting Julia and running InteractiveUtils.versioninfo() takes a significant amount of time (1s or ~10% of the total build time in testing),
|
||||
# so you may not want to run it in every build, in particular on paid runners, as this cost will add up quickly.
|
||||
#
|
||||
# See "versioninfo" below for example usage and further explanations.
|
||||
#
|
||||
# Supported values: true | false | never
|
||||
#
|
||||
# true: Always print versioninfo
|
||||
# false: Only print versioninfo for nightly Julia
|
||||
# never: Never print versioninfo
|
||||
# If true, display the output of InteractiveUtils.versioninfo() after installing.
|
||||
# See "versioninfo" below for example usage.
|
||||
#
|
||||
# Default: false
|
||||
show-versioninfo: ''
|
||||
@@ -107,7 +92,6 @@ You can either specify specific Julia versions or version ranges. If you specify
|
||||
- `^1.3.0-0` is a **caret** version range that includes _all_ pre-releases. It matches all versions `≥ 1.3.0-` and `< 2.0.0`.
|
||||
- `~1.3.0-0` is a **tilde** version range that includes _all_ pre-releases. It matches all versions `≥ 1.3.0-` and `< 1.4.0`.
|
||||
- `nightly` will install the latest nightly build.
|
||||
- `1.7-nightly` will install the latest nightly build for the upcoming 1.7 release. This version will only be available during certain phases of the Julia release cycle.
|
||||
|
||||
Internally the action uses node's semver package to resolve version ranges. Its [documentation](https://github.com/npm/node-semver#advanced-range-syntax) contains more details on the version range syntax. You can test what version will be selected for a given input in this JavaScript [REPL](https://repl.it/@SaschaMann/setup-julia-version-logic).
|
||||
|
||||
@@ -193,13 +177,18 @@ jobs:
|
||||
|
||||
### versioninfo
|
||||
|
||||
By default, only the output of `julia --version` is printed as verification that Julia has been installed for stable versions of Julia.
|
||||
`InteractiveUtils.versioninfo()` is run by default for nightly builds.
|
||||
By default, only a brief version identifier is printed in the run log. You can display the full `versioninfo` by adding `show-versioninfo`.
|
||||
Here's an example that prints this information just for `nightly`:
|
||||
|
||||
Starting Julia and printing the full versioninfo takes a significant amount of time (1s or ~10% of the total build time in testing), so you may not want to run it in every build, in particular on paid runners as this cost will add up quickly.
|
||||
However, `julia --version` does not provide sufficient information to know which commit a nightly binary was built from, therefore it is useful to show the full versioninfo on nightly builds regardless.
|
||||
|
||||
You can override this behaviour by changing the input to `never` if you never want to run `InteractiveUtils.versioninfo()` or to `true` if you always want to run `InteractiveUtils.versioninfo()`, even on stable Julia builds.
|
||||
```yaml
|
||||
- uses: julia-actions/setup-julia@v1
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
arch: ${{ matrix.arch }}
|
||||
show-versioninfo: ${{ matrix.version == 'nightly' }}
|
||||
```
|
||||
|
||||
You use `'true'` if you want it printed for all Julia versions.
|
||||
|
||||
## Versioning
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ outputs:
|
||||
julia-bindir:
|
||||
description: 'Path to the directory containing the Julia executable. Equivalent to JULIA_BINDIR: https://docs.julialang.org/en/v1/manual/environment-variables/#JULIA_BINDIR'
|
||||
runs:
|
||||
using: 'node16'
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
branding:
|
||||
icon: 'download'
|
||||
|
||||
2
bin
2
bin
Submodule bin updated: 31b4b500a3...9ceca17c9c
450
dist/index.js
vendored
450
dist/index.js
vendored
@@ -2880,13 +2880,6 @@ function coerce (version, options) {
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 321:
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(600);
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 357:
|
||||
@@ -3240,73 +3233,6 @@ function getState(name) {
|
||||
exports.getState = getState;
|
||||
//# sourceMappingURL=core.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 523:
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
|
||||
// Packages
|
||||
var retrier = __webpack_require__(321);
|
||||
|
||||
function retry(fn, opts) {
|
||||
function run(resolve, reject) {
|
||||
var options = opts || {};
|
||||
|
||||
// Default `randomize` to true
|
||||
if (!('randomize' in options)) {
|
||||
options.randomize = true;
|
||||
}
|
||||
|
||||
var op = retrier.operation(options);
|
||||
|
||||
// We allow the user to abort retrying
|
||||
// this makes sense in the cases where
|
||||
// knowledge is obtained that retrying
|
||||
// would be futile (e.g.: auth errors)
|
||||
|
||||
function bail(err) {
|
||||
reject(err || new Error('Aborted'));
|
||||
}
|
||||
|
||||
function onError(err, num) {
|
||||
if (err.bail) {
|
||||
bail(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!op.retry(err)) {
|
||||
reject(op.mainError());
|
||||
} else if (options.onRetry) {
|
||||
options.onRetry(err, num);
|
||||
}
|
||||
}
|
||||
|
||||
function runAttempt(num) {
|
||||
var val;
|
||||
|
||||
try {
|
||||
val = fn(bail, num);
|
||||
} catch (err) {
|
||||
onError(err, num);
|
||||
return;
|
||||
}
|
||||
|
||||
Promise.resolve(val)
|
||||
.then(resolve)
|
||||
.catch(function catchIt(err) {
|
||||
onError(err, num);
|
||||
});
|
||||
}
|
||||
|
||||
op.attempt(runAttempt);
|
||||
}
|
||||
|
||||
return new Promise(run);
|
||||
}
|
||||
|
||||
module.exports = retry;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 533:
|
||||
@@ -3750,113 +3676,6 @@ function _evaluateVersions(versions, versionSpec) {
|
||||
}
|
||||
//# sourceMappingURL=tool-cache.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 600:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
var RetryOperation = __webpack_require__(988);
|
||||
|
||||
exports.operation = function(options) {
|
||||
var timeouts = exports.timeouts(options);
|
||||
return new RetryOperation(timeouts, {
|
||||
forever: options && options.forever,
|
||||
unref: options && options.unref,
|
||||
maxRetryTime: options && options.maxRetryTime
|
||||
});
|
||||
};
|
||||
|
||||
exports.timeouts = function(options) {
|
||||
if (options instanceof Array) {
|
||||
return [].concat(options);
|
||||
}
|
||||
|
||||
var opts = {
|
||||
retries: 10,
|
||||
factor: 2,
|
||||
minTimeout: 1 * 1000,
|
||||
maxTimeout: Infinity,
|
||||
randomize: false
|
||||
};
|
||||
for (var key in options) {
|
||||
opts[key] = options[key];
|
||||
}
|
||||
|
||||
if (opts.minTimeout > opts.maxTimeout) {
|
||||
throw new Error('minTimeout is greater than maxTimeout');
|
||||
}
|
||||
|
||||
var timeouts = [];
|
||||
for (var i = 0; i < opts.retries; i++) {
|
||||
timeouts.push(this.createTimeout(i, opts));
|
||||
}
|
||||
|
||||
if (options && options.forever && !timeouts.length) {
|
||||
timeouts.push(this.createTimeout(i, opts));
|
||||
}
|
||||
|
||||
// sort the array numerically ascending
|
||||
timeouts.sort(function(a,b) {
|
||||
return a - b;
|
||||
});
|
||||
|
||||
return timeouts;
|
||||
};
|
||||
|
||||
exports.createTimeout = function(attempt, opts) {
|
||||
var random = (opts.randomize)
|
||||
? (Math.random() + 1)
|
||||
: 1;
|
||||
|
||||
var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
|
||||
timeout = Math.min(timeout, opts.maxTimeout);
|
||||
|
||||
return timeout;
|
||||
};
|
||||
|
||||
exports.wrap = function(obj, options, methods) {
|
||||
if (options instanceof Array) {
|
||||
methods = options;
|
||||
options = null;
|
||||
}
|
||||
|
||||
if (!methods) {
|
||||
methods = [];
|
||||
for (var key in obj) {
|
||||
if (typeof obj[key] === 'function') {
|
||||
methods.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < methods.length; i++) {
|
||||
var method = methods[i];
|
||||
var original = obj[method];
|
||||
|
||||
obj[method] = function retryWrapper(original) {
|
||||
var op = exports.operation(options);
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
var callback = args.pop();
|
||||
|
||||
args.push(function(err) {
|
||||
if (op.retry(err)) {
|
||||
return;
|
||||
}
|
||||
if (err) {
|
||||
arguments[0] = op.mainError();
|
||||
}
|
||||
callback.apply(this, arguments);
|
||||
});
|
||||
|
||||
op.attempt(function() {
|
||||
original.apply(obj, args);
|
||||
});
|
||||
}.bind(obj, original);
|
||||
obj[method].options = options;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 605:
|
||||
@@ -4148,6 +3967,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const exec = __importStar(__webpack_require__(986));
|
||||
const tc = __importStar(__webpack_require__(533));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const https = __importStar(__webpack_require__(211));
|
||||
@@ -4209,9 +4029,12 @@ function run() {
|
||||
core.addPath(path.join(juliaPath, 'bin'));
|
||||
// Set output
|
||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'));
|
||||
// Test if Julia has been installed and print the version
|
||||
const showVersionInfoInput = core.getInput('show-versioninfo');
|
||||
yield installer.showVersionInfo(showVersionInfoInput, version);
|
||||
// Test if Julia has been installed
|
||||
exec.exec('julia', ['--version']);
|
||||
// If enabled, also show the full version info
|
||||
if (core.getInput('show-versioninfo') == 'true') {
|
||||
exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()']);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
@@ -4258,7 +4081,6 @@ const crypto = __importStar(__webpack_require__(417));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const retry = __webpack_require__(523);
|
||||
const semver = __importStar(__webpack_require__(280));
|
||||
// Translations between actions input and Julia arch names
|
||||
const osMap = {
|
||||
@@ -4268,8 +4090,7 @@ const osMap = {
|
||||
};
|
||||
const archMap = {
|
||||
'x86': 'i686',
|
||||
'x64': 'x86_64',
|
||||
'aarch64': 'aarch64'
|
||||
'x64': 'x86_64'
|
||||
};
|
||||
// Store information about the environment
|
||||
const osPlat = os.platform(); // possible values: win32 (Windows), linux (Linux), darwin (macOS)
|
||||
@@ -4297,15 +4118,7 @@ function calculateChecksum(file) {
|
||||
*/
|
||||
function getJuliaVersionInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Occasionally the connection is reset for unknown reasons
|
||||
// In those cases, retry the download
|
||||
const versionsFile = yield retry((bail) => __awaiter(this, void 0, void 0, function* () {
|
||||
return yield tc.downloadTool('https://julialang-s3.julialang.org/bin/versions.json');
|
||||
}), {
|
||||
onRetry: (err) => {
|
||||
core.debug(`Download of versions.json failed, trying again. Error: ${err}`);
|
||||
}
|
||||
});
|
||||
const versionsFile = yield tc.downloadTool('https://julialang-s3.julialang.org/bin/versions.json');
|
||||
return JSON.parse(fs.readFileSync(versionsFile).toString());
|
||||
});
|
||||
}
|
||||
@@ -4324,10 +4137,14 @@ function getJuliaVersions(versionInfo) {
|
||||
}
|
||||
exports.getJuliaVersions = getJuliaVersions;
|
||||
function getJuliaVersion(availableReleases, versionInput) {
|
||||
if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) {
|
||||
// versionInput is a valid version or a nightly version, use it directly
|
||||
if (semver.valid(versionInput) == versionInput) {
|
||||
// versionInput is a valid version, use it directly
|
||||
return versionInput;
|
||||
}
|
||||
// nightlies
|
||||
if (versionInput == 'nightly') {
|
||||
return 'nightly';
|
||||
}
|
||||
// Use the highest available version that matches versionInput
|
||||
let version = semver.maxSatisfying(availableReleases, versionInput);
|
||||
if (version == null) {
|
||||
@@ -4361,35 +4178,22 @@ function getNightlyFileName(arch) {
|
||||
return `julia-latest${versionExt}.${ext}`;
|
||||
}
|
||||
function getFileInfo(versionInfo, version, arch) {
|
||||
const err = `Could not find ${archMap[arch]}/${version} binaries`;
|
||||
if (version.endsWith('nightly')) {
|
||||
if (version == 'nightly') {
|
||||
return null;
|
||||
}
|
||||
if (!versionInfo[version]) {
|
||||
throw err;
|
||||
}
|
||||
for (let file of versionInfo[version].files) {
|
||||
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
throw err;
|
||||
throw `Could not find ${archMap[arch]}/${version} binaries`;
|
||||
}
|
||||
exports.getFileInfo = getFileInfo;
|
||||
function getDownloadURL(fileInfo, version, arch) {
|
||||
const baseURL = `https://julialangnightlies-s3.julialang.org/bin/${osMap[osPlat]}/${arch}`;
|
||||
// release branch nightlies, e.g. 1.6-nightlies should return .../bin/linux/x64/1.6/julia-latest-linux64.tar.gz
|
||||
const majorMinorMatches = /^(\d*.\d*)-nightly/.exec(version);
|
||||
if (majorMinorMatches) {
|
||||
return `${baseURL}/${majorMinorMatches[1]}/${getNightlyFileName(arch)}`;
|
||||
}
|
||||
// nightlies
|
||||
if (version == 'nightly') {
|
||||
return `${baseURL}/${getNightlyFileName(arch)}`;
|
||||
}
|
||||
// Verify that fileInfo.url points at the official Julia download servers
|
||||
if (!fileInfo.url.startsWith('https://julialang-s3.julialang.org/')) {
|
||||
throw new Error(`versions.json points at a download location outside of Julia's download server: ${fileInfo.url}. Aborting for security reasons.`);
|
||||
const baseURL = 'https://julialangnightlies-s3.julialang.org/bin';
|
||||
return `${baseURL}/${osMap[osPlat]}/${arch}/${getNightlyFileName(arch)}`;
|
||||
}
|
||||
return fileInfo.url;
|
||||
}
|
||||
@@ -4400,17 +4204,9 @@ function installJulia(versionInfo, version, arch) {
|
||||
const fileInfo = getFileInfo(versionInfo, version, arch);
|
||||
const downloadURL = getDownloadURL(fileInfo, version, arch);
|
||||
core.debug(`downloading Julia from ${downloadURL}`);
|
||||
// Occasionally the connection is reset for unknown reasons
|
||||
// In those cases, retry the download
|
||||
const juliaDownloadPath = yield retry((bail) => __awaiter(this, void 0, void 0, function* () {
|
||||
return yield tc.downloadTool(downloadURL);
|
||||
}), {
|
||||
onRetry: (err) => {
|
||||
core.debug(`Download of ${downloadURL} failed, trying again. Error: ${err}`);
|
||||
}
|
||||
});
|
||||
const juliaDownloadPath = yield tc.downloadTool(downloadURL);
|
||||
// Verify checksum
|
||||
if (!version.endsWith('nightly')) {
|
||||
if (version != 'nightly') {
|
||||
const checkSum = yield calculateChecksum(juliaDownloadPath);
|
||||
if (fileInfo.sha256 != checkSum) {
|
||||
throw new Error(`Checksum of downloaded file does not match the expected checksum from versions.json.\nExpected: ${fileInfo.sha256}\nGot: ${checkSum}`);
|
||||
@@ -4428,7 +4224,7 @@ function installJulia(versionInfo, version, arch) {
|
||||
yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]);
|
||||
return tempInstallDir;
|
||||
case 'win32':
|
||||
if (version.endsWith('nightly') || semver.gtr(version, '1.3', { includePrerelease: true })) {
|
||||
if (version == 'nightly' || semver.gtr(version, '1.3', { includePrerelease: true })) {
|
||||
// The installer changed in 1.4: https://github.com/JuliaLang/julia/blob/ef0c9108b12f3ae177c51037934351ffa703b0b5/NEWS.md#build-system-changes
|
||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]);
|
||||
}
|
||||
@@ -4446,43 +4242,6 @@ function installJulia(versionInfo, version, arch) {
|
||||
});
|
||||
}
|
||||
exports.installJulia = installJulia;
|
||||
/**
|
||||
* Test if Julia has been installed and print the version.
|
||||
*
|
||||
* true => always show versioninfo
|
||||
* false => only show on nightlies
|
||||
* never => never show it anywhere
|
||||
*
|
||||
* @param showVersionInfoInput
|
||||
*/
|
||||
function showVersionInfo(showVersionInfoInput, version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// --compile=min -O0 reduces the time from ~1.8-1.9s to ~0.8-0.9s
|
||||
let exitCode;
|
||||
switch (showVersionInfoInput) {
|
||||
case 'true':
|
||||
exitCode = yield exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()']);
|
||||
break;
|
||||
case 'false':
|
||||
if (version.endsWith('nightly')) {
|
||||
exitCode = yield exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()']);
|
||||
}
|
||||
else {
|
||||
exitCode = yield exec.exec('julia', ['--version']);
|
||||
}
|
||||
break;
|
||||
case 'never':
|
||||
exitCode = yield exec.exec('julia', ['--version']);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`${showVersionInfoInput} is not a valid value for show-versioninfo. Supported values: true | false | never`);
|
||||
}
|
||||
if (exitCode !== 0) {
|
||||
throw new Error(`Julia could not be installed properly. Exit code: ${exitCode}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.showVersionInfo = showVersionInfo;
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -5034,171 +4793,6 @@ function exec(commandLine, args, options) {
|
||||
exports.exec = exec;
|
||||
//# sourceMappingURL=exec.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 988:
|
||||
/***/ (function(module) {
|
||||
|
||||
function RetryOperation(timeouts, options) {
|
||||
// Compatibility for the old (timeouts, retryForever) signature
|
||||
if (typeof options === 'boolean') {
|
||||
options = { forever: options };
|
||||
}
|
||||
|
||||
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
||||
this._timeouts = timeouts;
|
||||
this._options = options || {};
|
||||
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
||||
this._fn = null;
|
||||
this._errors = [];
|
||||
this._attempts = 1;
|
||||
this._operationTimeout = null;
|
||||
this._operationTimeoutCb = null;
|
||||
this._timeout = null;
|
||||
this._operationStart = null;
|
||||
|
||||
if (this._options.forever) {
|
||||
this._cachedTimeouts = this._timeouts.slice(0);
|
||||
}
|
||||
}
|
||||
module.exports = RetryOperation;
|
||||
|
||||
RetryOperation.prototype.reset = function() {
|
||||
this._attempts = 1;
|
||||
this._timeouts = this._originalTimeouts;
|
||||
}
|
||||
|
||||
RetryOperation.prototype.stop = function() {
|
||||
if (this._timeout) {
|
||||
clearTimeout(this._timeout);
|
||||
}
|
||||
|
||||
this._timeouts = [];
|
||||
this._cachedTimeouts = null;
|
||||
};
|
||||
|
||||
RetryOperation.prototype.retry = function(err) {
|
||||
if (this._timeout) {
|
||||
clearTimeout(this._timeout);
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
return false;
|
||||
}
|
||||
var currentTime = new Date().getTime();
|
||||
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
||||
this._errors.unshift(new Error('RetryOperation timeout occurred'));
|
||||
return false;
|
||||
}
|
||||
|
||||
this._errors.push(err);
|
||||
|
||||
var timeout = this._timeouts.shift();
|
||||
if (timeout === undefined) {
|
||||
if (this._cachedTimeouts) {
|
||||
// retry forever, only keep last error
|
||||
this._errors.splice(this._errors.length - 1, this._errors.length);
|
||||
this._timeouts = this._cachedTimeouts.slice(0);
|
||||
timeout = this._timeouts.shift();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var self = this;
|
||||
var timer = setTimeout(function() {
|
||||
self._attempts++;
|
||||
|
||||
if (self._operationTimeoutCb) {
|
||||
self._timeout = setTimeout(function() {
|
||||
self._operationTimeoutCb(self._attempts);
|
||||
}, self._operationTimeout);
|
||||
|
||||
if (self._options.unref) {
|
||||
self._timeout.unref();
|
||||
}
|
||||
}
|
||||
|
||||
self._fn(self._attempts);
|
||||
}, timeout);
|
||||
|
||||
if (this._options.unref) {
|
||||
timer.unref();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
||||
this._fn = fn;
|
||||
|
||||
if (timeoutOps) {
|
||||
if (timeoutOps.timeout) {
|
||||
this._operationTimeout = timeoutOps.timeout;
|
||||
}
|
||||
if (timeoutOps.cb) {
|
||||
this._operationTimeoutCb = timeoutOps.cb;
|
||||
}
|
||||
}
|
||||
|
||||
var self = this;
|
||||
if (this._operationTimeoutCb) {
|
||||
this._timeout = setTimeout(function() {
|
||||
self._operationTimeoutCb();
|
||||
}, self._operationTimeout);
|
||||
}
|
||||
|
||||
this._operationStart = new Date().getTime();
|
||||
|
||||
this._fn(this._attempts);
|
||||
};
|
||||
|
||||
RetryOperation.prototype.try = function(fn) {
|
||||
console.log('Using RetryOperation.try() is deprecated');
|
||||
this.attempt(fn);
|
||||
};
|
||||
|
||||
RetryOperation.prototype.start = function(fn) {
|
||||
console.log('Using RetryOperation.start() is deprecated');
|
||||
this.attempt(fn);
|
||||
};
|
||||
|
||||
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
||||
|
||||
RetryOperation.prototype.errors = function() {
|
||||
return this._errors;
|
||||
};
|
||||
|
||||
RetryOperation.prototype.attempts = function() {
|
||||
return this._attempts;
|
||||
};
|
||||
|
||||
RetryOperation.prototype.mainError = function() {
|
||||
if (this._errors.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var counts = {};
|
||||
var mainError = null;
|
||||
var mainErrorCount = 0;
|
||||
|
||||
for (var i = 0; i < this._errors.length; i++) {
|
||||
var error = this._errors[i];
|
||||
var message = error.message;
|
||||
var count = (counts[message] || 0) + 1;
|
||||
|
||||
counts[message] = count;
|
||||
|
||||
if (count >= mainErrorCount) {
|
||||
mainError = error;
|
||||
mainErrorCount = count;
|
||||
}
|
||||
}
|
||||
|
||||
return mainError;
|
||||
};
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
94
lib/installer.js
generated
94
lib/installer.js
generated
@@ -22,7 +22,6 @@ const crypto = __importStar(require("crypto"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const retry = require("async-retry");
|
||||
const semver = __importStar(require("semver"));
|
||||
// Translations between actions input and Julia arch names
|
||||
const osMap = {
|
||||
@@ -32,8 +31,7 @@ const osMap = {
|
||||
};
|
||||
const archMap = {
|
||||
'x86': 'i686',
|
||||
'x64': 'x86_64',
|
||||
'aarch64': 'aarch64'
|
||||
'x64': 'x86_64'
|
||||
};
|
||||
// Store information about the environment
|
||||
const osPlat = os.platform(); // possible values: win32 (Windows), linux (Linux), darwin (macOS)
|
||||
@@ -61,15 +59,7 @@ function calculateChecksum(file) {
|
||||
*/
|
||||
function getJuliaVersionInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Occasionally the connection is reset for unknown reasons
|
||||
// In those cases, retry the download
|
||||
const versionsFile = yield retry((bail) => __awaiter(this, void 0, void 0, function* () {
|
||||
return yield tc.downloadTool('https://julialang-s3.julialang.org/bin/versions.json');
|
||||
}), {
|
||||
onRetry: (err) => {
|
||||
core.debug(`Download of versions.json failed, trying again. Error: ${err}`);
|
||||
}
|
||||
});
|
||||
const versionsFile = yield tc.downloadTool('https://julialang-s3.julialang.org/bin/versions.json');
|
||||
return JSON.parse(fs.readFileSync(versionsFile).toString());
|
||||
});
|
||||
}
|
||||
@@ -88,10 +78,14 @@ function getJuliaVersions(versionInfo) {
|
||||
}
|
||||
exports.getJuliaVersions = getJuliaVersions;
|
||||
function getJuliaVersion(availableReleases, versionInput) {
|
||||
if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) {
|
||||
// versionInput is a valid version or a nightly version, use it directly
|
||||
if (semver.valid(versionInput) == versionInput) {
|
||||
// versionInput is a valid version, use it directly
|
||||
return versionInput;
|
||||
}
|
||||
// nightlies
|
||||
if (versionInput == 'nightly') {
|
||||
return 'nightly';
|
||||
}
|
||||
// Use the highest available version that matches versionInput
|
||||
let version = semver.maxSatisfying(availableReleases, versionInput);
|
||||
if (version == null) {
|
||||
@@ -125,35 +119,22 @@ function getNightlyFileName(arch) {
|
||||
return `julia-latest${versionExt}.${ext}`;
|
||||
}
|
||||
function getFileInfo(versionInfo, version, arch) {
|
||||
const err = `Could not find ${archMap[arch]}/${version} binaries`;
|
||||
if (version.endsWith('nightly')) {
|
||||
if (version == 'nightly') {
|
||||
return null;
|
||||
}
|
||||
if (!versionInfo[version]) {
|
||||
throw err;
|
||||
}
|
||||
for (let file of versionInfo[version].files) {
|
||||
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
throw err;
|
||||
throw `Could not find ${archMap[arch]}/${version} binaries`;
|
||||
}
|
||||
exports.getFileInfo = getFileInfo;
|
||||
function getDownloadURL(fileInfo, version, arch) {
|
||||
const baseURL = `https://julialangnightlies-s3.julialang.org/bin/${osMap[osPlat]}/${arch}`;
|
||||
// release branch nightlies, e.g. 1.6-nightlies should return .../bin/linux/x64/1.6/julia-latest-linux64.tar.gz
|
||||
const majorMinorMatches = /^(\d*.\d*)-nightly/.exec(version);
|
||||
if (majorMinorMatches) {
|
||||
return `${baseURL}/${majorMinorMatches[1]}/${getNightlyFileName(arch)}`;
|
||||
}
|
||||
// nightlies
|
||||
if (version == 'nightly') {
|
||||
return `${baseURL}/${getNightlyFileName(arch)}`;
|
||||
}
|
||||
// Verify that fileInfo.url points at the official Julia download servers
|
||||
if (!fileInfo.url.startsWith('https://julialang-s3.julialang.org/')) {
|
||||
throw new Error(`versions.json points at a download location outside of Julia's download server: ${fileInfo.url}. Aborting for security reasons.`);
|
||||
const baseURL = 'https://julialangnightlies-s3.julialang.org/bin';
|
||||
return `${baseURL}/${osMap[osPlat]}/${arch}/${getNightlyFileName(arch)}`;
|
||||
}
|
||||
return fileInfo.url;
|
||||
}
|
||||
@@ -164,17 +145,9 @@ function installJulia(versionInfo, version, arch) {
|
||||
const fileInfo = getFileInfo(versionInfo, version, arch);
|
||||
const downloadURL = getDownloadURL(fileInfo, version, arch);
|
||||
core.debug(`downloading Julia from ${downloadURL}`);
|
||||
// Occasionally the connection is reset for unknown reasons
|
||||
// In those cases, retry the download
|
||||
const juliaDownloadPath = yield retry((bail) => __awaiter(this, void 0, void 0, function* () {
|
||||
return yield tc.downloadTool(downloadURL);
|
||||
}), {
|
||||
onRetry: (err) => {
|
||||
core.debug(`Download of ${downloadURL} failed, trying again. Error: ${err}`);
|
||||
}
|
||||
});
|
||||
const juliaDownloadPath = yield tc.downloadTool(downloadURL);
|
||||
// Verify checksum
|
||||
if (!version.endsWith('nightly')) {
|
||||
if (version != 'nightly') {
|
||||
const checkSum = yield calculateChecksum(juliaDownloadPath);
|
||||
if (fileInfo.sha256 != checkSum) {
|
||||
throw new Error(`Checksum of downloaded file does not match the expected checksum from versions.json.\nExpected: ${fileInfo.sha256}\nGot: ${checkSum}`);
|
||||
@@ -192,7 +165,7 @@ function installJulia(versionInfo, version, arch) {
|
||||
yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]);
|
||||
return tempInstallDir;
|
||||
case 'win32':
|
||||
if (version.endsWith('nightly') || semver.gtr(version, '1.3', { includePrerelease: true })) {
|
||||
if (version == 'nightly' || semver.gtr(version, '1.3', { includePrerelease: true })) {
|
||||
// The installer changed in 1.4: https://github.com/JuliaLang/julia/blob/ef0c9108b12f3ae177c51037934351ffa703b0b5/NEWS.md#build-system-changes
|
||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]);
|
||||
}
|
||||
@@ -210,40 +183,3 @@ function installJulia(versionInfo, version, arch) {
|
||||
});
|
||||
}
|
||||
exports.installJulia = installJulia;
|
||||
/**
|
||||
* Test if Julia has been installed and print the version.
|
||||
*
|
||||
* true => always show versioninfo
|
||||
* false => only show on nightlies
|
||||
* never => never show it anywhere
|
||||
*
|
||||
* @param showVersionInfoInput
|
||||
*/
|
||||
function showVersionInfo(showVersionInfoInput, version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// --compile=min -O0 reduces the time from ~1.8-1.9s to ~0.8-0.9s
|
||||
let exitCode;
|
||||
switch (showVersionInfoInput) {
|
||||
case 'true':
|
||||
exitCode = yield exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()']);
|
||||
break;
|
||||
case 'false':
|
||||
if (version.endsWith('nightly')) {
|
||||
exitCode = yield exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()']);
|
||||
}
|
||||
else {
|
||||
exitCode = yield exec.exec('julia', ['--version']);
|
||||
}
|
||||
break;
|
||||
case 'never':
|
||||
exitCode = yield exec.exec('julia', ['--version']);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`${showVersionInfoInput} is not a valid value for show-versioninfo. Supported values: true | false | never`);
|
||||
}
|
||||
if (exitCode !== 0) {
|
||||
throw new Error(`Julia could not be installed properly. Exit code: ${exitCode}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.showVersionInfo = showVersionInfo;
|
||||
|
||||
10
lib/setup-julia.js
generated
10
lib/setup-julia.js
generated
@@ -16,6 +16,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const https = __importStar(require("https"));
|
||||
@@ -77,9 +78,12 @@ function run() {
|
||||
core.addPath(path.join(juliaPath, 'bin'));
|
||||
// Set output
|
||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'));
|
||||
// Test if Julia has been installed and print the version
|
||||
const showVersionInfoInput = core.getInput('show-versioninfo');
|
||||
yield installer.showVersionInfo(showVersionInfoInput, version);
|
||||
// Test if Julia has been installed
|
||||
exec.exec('julia', ['--version']);
|
||||
// If enabled, also show the full version info
|
||||
if (core.getInput('show-versioninfo') == 'true') {
|
||||
exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()']);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
||||
8585
package-lock.json
generated
8585
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-julia",
|
||||
"version": "1.7.1",
|
||||
"version": "1.5.0",
|
||||
"private": true,
|
||||
"description": "setup Julia action",
|
||||
"main": "lib/setup-julia.js",
|
||||
@@ -25,11 +25,9 @@
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/io": "^1.0.0",
|
||||
"@actions/tool-cache": "^1.0.0",
|
||||
"async-retry": "^1.3.1",
|
||||
"semver": "^6.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/async-retry": "^1.4.2",
|
||||
"@types/jest": "^24.0.13",
|
||||
"@types/node": "^12.12.7",
|
||||
"@types/semver": "^6.0.0",
|
||||
|
||||
103
src/installer.ts
103
src/installer.ts
@@ -6,7 +6,6 @@ import * as crypto from 'crypto'
|
||||
import * as fs from 'fs'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import retry = require('async-retry')
|
||||
|
||||
import * as semver from 'semver'
|
||||
|
||||
@@ -18,8 +17,7 @@ const osMap = {
|
||||
}
|
||||
const archMap = {
|
||||
'x86': 'i686',
|
||||
'x64': 'x86_64',
|
||||
'aarch64': 'aarch64'
|
||||
'x64': 'x86_64'
|
||||
}
|
||||
|
||||
// Store information about the environment
|
||||
@@ -49,15 +47,7 @@ async function calculateChecksum(file: string): Promise<string> {
|
||||
* @returns The content of the downloaded versions.json file as object.
|
||||
*/
|
||||
export async function getJuliaVersionInfo(): Promise<object> {
|
||||
// Occasionally the connection is reset for unknown reasons
|
||||
// In those cases, retry the download
|
||||
const versionsFile = await retry(async (bail: Function) => {
|
||||
return await tc.downloadTool('https://julialang-s3.julialang.org/bin/versions.json')
|
||||
}, {
|
||||
onRetry: (err: Error) => {
|
||||
core.debug(`Download of versions.json failed, trying again. Error: ${err}`)
|
||||
}
|
||||
})
|
||||
const versionsFile = await tc.downloadTool('https://julialang-s3.julialang.org/bin/versions.json')
|
||||
|
||||
return JSON.parse(fs.readFileSync(versionsFile).toString())
|
||||
}
|
||||
@@ -76,11 +66,16 @@ export async function getJuliaVersions(versionInfo): Promise<string[]> {
|
||||
}
|
||||
|
||||
export function getJuliaVersion(availableReleases: string[], versionInput: string): string {
|
||||
if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) {
|
||||
// versionInput is a valid version or a nightly version, use it directly
|
||||
if (semver.valid(versionInput) == versionInput) {
|
||||
// versionInput is a valid version, use it directly
|
||||
return versionInput
|
||||
}
|
||||
|
||||
// nightlies
|
||||
if (versionInput == 'nightly') {
|
||||
return 'nightly'
|
||||
}
|
||||
|
||||
// Use the highest available version that matches versionInput
|
||||
let version = semver.maxSatisfying(availableReleases, versionInput)
|
||||
if (version == null) {
|
||||
@@ -116,43 +111,26 @@ function getNightlyFileName(arch: string): string {
|
||||
}
|
||||
|
||||
export function getFileInfo(versionInfo, version: string, arch: string) {
|
||||
const err = `Could not find ${archMap[arch]}/${version} binaries`
|
||||
|
||||
if (version.endsWith('nightly')) {
|
||||
if (version == 'nightly') {
|
||||
return null
|
||||
}
|
||||
|
||||
if (!versionInfo[version]) {
|
||||
throw err
|
||||
}
|
||||
|
||||
for (let file of versionInfo[version].files) {
|
||||
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
|
||||
return file
|
||||
}
|
||||
}
|
||||
|
||||
throw err
|
||||
throw `Could not find ${archMap[arch]}/${version} binaries`
|
||||
}
|
||||
|
||||
export function getDownloadURL(fileInfo, version: string, arch: string): string {
|
||||
const baseURL = `https://julialangnightlies-s3.julialang.org/bin/${osMap[osPlat]}/${arch}`
|
||||
|
||||
// release branch nightlies, e.g. 1.6-nightlies should return .../bin/linux/x64/1.6/julia-latest-linux64.tar.gz
|
||||
const majorMinorMatches = /^(\d*.\d*)-nightly/.exec(version)
|
||||
if (majorMinorMatches) {
|
||||
return `${baseURL}/${majorMinorMatches[1]}/${getNightlyFileName(arch)}`
|
||||
}
|
||||
|
||||
// nightlies
|
||||
if (version == 'nightly') {
|
||||
return `${baseURL}/${getNightlyFileName(arch)}`
|
||||
const baseURL = 'https://julialangnightlies-s3.julialang.org/bin'
|
||||
return `${baseURL}/${osMap[osPlat]}/${arch}/${getNightlyFileName(arch)}`
|
||||
}
|
||||
|
||||
// Verify that fileInfo.url points at the official Julia download servers
|
||||
if (!fileInfo.url.startsWith('https://julialang-s3.julialang.org/')) {
|
||||
throw new Error(`versions.json points at a download location outside of Julia's download server: ${fileInfo.url}. Aborting for security reasons.`)
|
||||
}
|
||||
return fileInfo.url
|
||||
}
|
||||
|
||||
@@ -161,20 +139,10 @@ export async function installJulia(versionInfo, version: string, arch: string):
|
||||
const fileInfo = getFileInfo(versionInfo, version, arch)
|
||||
const downloadURL = getDownloadURL(fileInfo, version, arch)
|
||||
core.debug(`downloading Julia from ${downloadURL}`)
|
||||
|
||||
// Occasionally the connection is reset for unknown reasons
|
||||
// In those cases, retry the download
|
||||
const juliaDownloadPath = await retry(async (bail: Function) => {
|
||||
return await tc.downloadTool(downloadURL)
|
||||
}, {
|
||||
onRetry: (err: Error) => {
|
||||
core.debug(`Download of ${downloadURL} failed, trying again. Error: ${err}`)
|
||||
}
|
||||
})
|
||||
|
||||
const juliaDownloadPath = await tc.downloadTool(downloadURL)
|
||||
|
||||
// Verify checksum
|
||||
if (!version.endsWith('nightly')) {
|
||||
if (version != 'nightly') {
|
||||
const checkSum = await calculateChecksum(juliaDownloadPath)
|
||||
if (fileInfo.sha256 != checkSum) {
|
||||
throw new Error(`Checksum of downloaded file does not match the expected checksum from versions.json.\nExpected: ${fileInfo.sha256}\nGot: ${checkSum}`)
|
||||
@@ -193,7 +161,7 @@ export async function installJulia(versionInfo, version: string, arch: string):
|
||||
await exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir])
|
||||
return tempInstallDir
|
||||
case 'win32':
|
||||
if (version.endsWith('nightly') || semver.gtr(version, '1.3', {includePrerelease: true})) {
|
||||
if (version == 'nightly' || semver.gtr(version, '1.3', {includePrerelease: true})) {
|
||||
// The installer changed in 1.4: https://github.com/JuliaLang/julia/blob/ef0c9108b12f3ae177c51037934351ffa703b0b5/NEWS.md#build-system-changes
|
||||
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`])
|
||||
} else {
|
||||
@@ -208,42 +176,3 @@ export async function installJulia(versionInfo, version: string, arch: string):
|
||||
throw new Error(`Platform ${osPlat} is not supported`)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if Julia has been installed and print the version.
|
||||
*
|
||||
* true => always show versioninfo
|
||||
* false => only show on nightlies
|
||||
* never => never show it anywhere
|
||||
*
|
||||
* @param showVersionInfoInput
|
||||
*/
|
||||
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
|
||||
let exitCode: number
|
||||
|
||||
switch (showVersionInfoInput) {
|
||||
case 'true':
|
||||
exitCode = await exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])
|
||||
break
|
||||
|
||||
case 'false':
|
||||
if (version.endsWith('nightly')) {
|
||||
exitCode = await exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])
|
||||
} else {
|
||||
exitCode = await exec.exec('julia', ['--version'])
|
||||
}
|
||||
break
|
||||
|
||||
case 'never':
|
||||
exitCode = await exec.exec('julia', ['--version'])
|
||||
break
|
||||
|
||||
default:
|
||||
throw new Error(`${showVersionInfoInput} is not a valid value for show-versioninfo. Supported values: true | false | never`)
|
||||
}
|
||||
|
||||
if (exitCode !== 0) {
|
||||
throw new Error(`Julia could not be installed properly. Exit code: ${exitCode}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,10 +73,14 @@ async function run() {
|
||||
|
||||
// Set output
|
||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'))
|
||||
|
||||
// Test if Julia has been installed
|
||||
exec.exec('julia', ['--version'])
|
||||
|
||||
// Test if Julia has been installed and print the version
|
||||
const showVersionInfoInput = core.getInput('show-versioninfo')
|
||||
await installer.showVersionInfo(showVersionInfoInput, version)
|
||||
// If enabled, also show the full version info
|
||||
if (core.getInput('show-versioninfo') == 'true') {
|
||||
exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()'])
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user