mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-12 02:56:54 +08:00
Change show-versioninfo to always print full info for nightlies (#68)
Co-authored-by: Derk-Jan Karrenbeld <derk-jan+github@karrenbeld.info>
This commit is contained in:
2
.github/workflows/example-builds-nightly.yml
vendored
2
.github/workflows/example-builds-nightly.yml
vendored
@@ -35,5 +35,5 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: ${{ matrix.julia-version }}
|
version: ${{ matrix.julia-version }}
|
||||||
arch: ${{ matrix.julia-arch }}
|
arch: ${{ matrix.julia-arch }}
|
||||||
show-versioninfo: 'true'
|
|
||||||
- run: julia --version
|
- run: julia --version
|
||||||
|
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
|
||||||
|
|||||||
2
.github/workflows/example-builds.yml
vendored
2
.github/workflows/example-builds.yml
vendored
@@ -34,5 +34,5 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: ${{ matrix.julia-version }}
|
version: ${{ matrix.julia-version }}
|
||||||
arch: ${{ matrix.julia-arch }}
|
arch: ${{ matrix.julia-arch }}
|
||||||
show-versioninfo: 'true'
|
|
||||||
- run: julia --version
|
- run: julia --version
|
||||||
|
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
|
||||||
|
|||||||
31
README.md
31
README.md
@@ -43,8 +43,18 @@ This action sets up a Julia environment for use in actions by downloading a spec
|
|||||||
# Default: x64
|
# Default: x64
|
||||||
arch: ''
|
arch: ''
|
||||||
|
|
||||||
# If true, display the output of InteractiveUtils.versioninfo() after installing.
|
# Set the display setting for printing InteractiveUtils.versioninfo() after installing.
|
||||||
# See "versioninfo" below for example usage.
|
#
|
||||||
|
# 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
|
||||||
#
|
#
|
||||||
# Default: false
|
# Default: false
|
||||||
show-versioninfo: ''
|
show-versioninfo: ''
|
||||||
@@ -179,18 +189,13 @@ jobs:
|
|||||||
|
|
||||||
### versioninfo
|
### versioninfo
|
||||||
|
|
||||||
By default, only a brief version identifier is printed in the run log. You can display the full `versioninfo` by adding `show-versioninfo`.
|
By default, only the output of `julia --version` is printed as verification that Julia has been installed for stable versions of Julia.
|
||||||
Here's an example that prints this information just for `nightly`:
|
`InteractiveUtils.versioninfo()` is run by default for nightly builds.
|
||||||
|
|
||||||
```yaml
|
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.
|
||||||
- uses: julia-actions/setup-julia@v1
|
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.
|
||||||
with:
|
|
||||||
version: ${{ matrix.version }}
|
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.
|
||||||
arch: ${{ matrix.arch }}
|
|
||||||
show-versioninfo: ${{ matrix.version == 'nightly' }}
|
|
||||||
```
|
|
||||||
|
|
||||||
You use `'true'` if you want it printed for all Julia versions.
|
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
|
|||||||
37
lib/installer.js
generated
37
lib/installer.js
generated
@@ -184,3 +184,40 @@ function installJulia(versionInfo, version, arch) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.installJulia = installJulia;
|
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;
|
||||||
|
|||||||
12
lib/setup-julia.js
generated
12
lib/setup-julia.js
generated
@@ -16,7 +16,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const exec = __importStar(require("@actions/exec"));
|
|
||||||
const tc = __importStar(require("@actions/tool-cache"));
|
const tc = __importStar(require("@actions/tool-cache"));
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const https = __importStar(require("https"));
|
const https = __importStar(require("https"));
|
||||||
@@ -79,15 +78,8 @@ function run() {
|
|||||||
// Set output
|
// Set output
|
||||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'));
|
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'));
|
||||||
// Test if Julia has been installed and print the version
|
// Test if Julia has been installed and print the version
|
||||||
if (core.getInput('show-versioninfo') == 'true') {
|
const showVersionInfoInput = core.getInput('show-versioninfo');
|
||||||
// If enabled, show the full version info
|
yield installer.showVersionInfo(showVersionInfoInput, version);
|
||||||
// --compile=min -O0 reduces the time from ~1.8-1.9s to ~0.8-0.9s
|
|
||||||
exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()']);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Otherwise only print julia --version to save time
|
|
||||||
exec.exec('julia', ['--version']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-julia",
|
"name": "setup-julia",
|
||||||
"version": "1.5.2",
|
"version": "1.6.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-julia",
|
"name": "setup-julia",
|
||||||
"version": "1.5.2",
|
"version": "1.6.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "setup Julia action",
|
"description": "setup Julia action",
|
||||||
"main": "lib/setup-julia.js",
|
"main": "lib/setup-julia.js",
|
||||||
|
|||||||
@@ -178,3 +178,42 @@ export async function installJulia(versionInfo, version: string, arch: string):
|
|||||||
throw new Error(`Platform ${osPlat} is not supported`)
|
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}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -75,14 +75,8 @@ async function run() {
|
|||||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'))
|
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'))
|
||||||
|
|
||||||
// Test if Julia has been installed and print the version
|
// Test if Julia has been installed and print the version
|
||||||
if (core.getInput('show-versioninfo') == 'true') {
|
const showVersionInfoInput = core.getInput('show-versioninfo')
|
||||||
// If enabled, show the full version info
|
await installer.showVersionInfo(showVersionInfoInput, version)
|
||||||
// --compile=min -O0 reduces the time from ~1.8-1.9s to ~0.8-0.9s
|
|
||||||
exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])
|
|
||||||
} else {
|
|
||||||
// Otherwise only print julia --version to save time
|
|
||||||
exec.exec('julia', ['--version'])
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user