Skip to content

Commit

Permalink
Add the optional tool-cache input, which allows the user to overrid…
Browse files Browse the repository at this point in the history
…e the location into which Julia is installed
  • Loading branch information
DilumAluthge committed Jul 28, 2022
1 parent ffea8bb commit 2258e98
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/example-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ jobs:
npm run build
npm run pack
- run: mkdir -p ${{ github.workspace }}/dilumtestcache # TODO: delete this line
- name: "Set up Julia"
id: setup-julia
uses: ./
with:
version: ${{ matrix.julia-version }}
arch: ${{ matrix.julia-arch }}
tool-cache: ${{ github.workspace }}/dilumtestcache # TODO: delete this line
- run: which julia # TODO: delete this line
- run: which -a julia # TODO: delete this line
- run: julia --version
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'Setup Julia environment'
description: 'Setup a Julia environment and add it to the PATH'
author: 'Sascha Mann'
inputs:
inputs:
version:
description: 'The Julia version to download (if necessary) and use. Example: 1.0.4'
default: '1'
Expand All @@ -13,6 +13,10 @@ inputs:
description: 'Display InteractiveUtils.versioninfo() after installing'
required: false
default: 'false'
tool-cache:
description: 'Override the value of the RUNNER_TOOL_CACHE environment variable.'
required: false
default: ''
outputs:
julia-version:
description: 'The installed Julia version. May vary from the version input if a version range was given as input.'
Expand Down
8 changes: 8 additions & 0 deletions lib/setup-julia.js

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

10 changes: 10 additions & 0 deletions src/setup-julia.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import * as core from '@actions/core'

// If we want to override the `RUNNER_TOOL_CACHE` environment variable, we need
// to do it before we load ``@actions/tool-cache`
const tool_cache_input_original = core.getInput('tool-cache')
const tool_cache_input_trimmed = tool_cache_input_original.trim()
if (tool_cache_input_trimmed.length > 0) {
process.env['RUNNER_TOOL_CACHE'] = tool_cache_input_trimmed
console.log('Overriding RUNNER_TOOL_CACHE -> ', process.env['RUNNER_TOOL_CACHE'])
}

import * as exec from '@actions/exec'
import * as tc from '@actions/tool-cache'

Expand Down

0 comments on commit 2258e98

Please sign in to comment.