Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change show-versioninfo to always print full info for nightlies #68

Merged
merged 6 commits into from
Jan 13, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Change show-versioninfo to always print full info for nightlies
SaschaMann committed Jan 12, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit f0e5bf810ee476a0c5319df2e615e66e732adcf0
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -43,8 +43,18 @@ This action sets up a Julia environment for use in actions by downloading a spec
# Default: x64
arch: ''

# If true, display the output of InteractiveUtils.versioninfo() after installing.
# See "versioninfo" below for example usage.
# 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
#
# Default: false
show-versioninfo: ''
@@ -179,18 +189,13 @@ jobs:

### versioninfo

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`:
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.

```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.
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.

## Versioning

30 changes: 30 additions & 0 deletions lib/installer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions lib/setup-julia.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions src/installer.ts
Original file line number Diff line number Diff line change
@@ -178,3 +178,33 @@ 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<number> {
// --compile=min -O0 reduces the time from ~1.8-1.9s to ~0.8-0.9s
switch (showVersionInfoInput) {
case 'true':
return exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])

case 'false':
if (version.endsWith('nightly')) {
return exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])
} else {
return exec.exec('julia', ['--version'])
}

case 'never':
return exec.exec('julia', ['--version'])

default:
throw new Error(`${showVersionInfoInput} is not a valid value for show-versioninfo. Supported values: true | false | never`)
}
}
10 changes: 2 additions & 8 deletions src/setup-julia.ts
Original file line number Diff line number Diff line change
@@ -75,14 +75,8 @@ async function run() {
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'))

// Test if Julia has been installed and print the version
if (core.getInput('show-versioninfo') == 'true') {
// If enabled, show the full version info
// --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'])
}
const showVersionInfoInput = core.getInput('show-versioninfo')
await installer.showVersionInfo(showVersionInfoInput, version)
} catch (error) {
core.setFailed(error.message)
}