diff --git a/.github/workflows/example-builds.yml b/.github/workflows/example-builds.yml index f3ebd9d7..e047eea5 100644 --- a/.github/workflows/example-builds.yml +++ b/.github/workflows/example-builds.yml @@ -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()' diff --git a/action.yml b/action.yml index 79105dd6..3abad830 100644 --- a/action.yml +++ b/action.yml @@ -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' @@ -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.' diff --git a/lib/setup-julia.js b/lib/setup-julia.js index e83f709a..799f9f4f 100644 --- a/lib/setup-julia.js +++ b/lib/setup-julia.js @@ -16,6 +16,14 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(require("@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']); +} const tc = __importStar(require("@actions/tool-cache")); const fs = __importStar(require("fs")); const https = __importStar(require("https")); diff --git a/src/setup-julia.ts b/src/setup-julia.ts index d27d9916..2a4667bb 100644 --- a/src/setup-julia.ts +++ b/src/setup-julia.ts @@ -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'