mirror of
https://github.com/julia-actions/cache.git
synced 2026-02-12 01:16:54 +08:00
64 lines
2.5 KiB
YAML
64 lines
2.5 KiB
YAML
name: 'Cache Julia artifacts, packages and registry'
|
|
description: 'Cache Julia using actions/cache'
|
|
author: 'Sascha Mann, Rik Huijzer, and contributors'
|
|
|
|
branding:
|
|
icon: 'archive'
|
|
color: 'purple'
|
|
|
|
inputs:
|
|
cache-name:
|
|
description: 'Name used as part of the cache keys'
|
|
default: 'julia-cache'
|
|
cache-artifacts:
|
|
description: 'Whether to cache ~/.julia/artifacts/'
|
|
default: 'true'
|
|
cache-packages:
|
|
description: 'Whether to cache ~/.julia/packages/'
|
|
default: 'true'
|
|
cache-registries:
|
|
description: 'Whether to cache ~/.julia/registries/'
|
|
default: 'false'
|
|
cache-compiled:
|
|
description: 'Whether to cache ~/.julia/compiled. USE WITH CAUTION! See https://github.com/julia-actions/cache/issues/11 for caveats.'
|
|
default: 'false'
|
|
cache-scratchspaces:
|
|
description: 'Whether to cache ~/.julia/scratchspaces/'
|
|
default: 'true'
|
|
|
|
outputs:
|
|
cache-hit:
|
|
description: 'A boolean value to indicate an exact match was found for the primary key. Returns \"\" when the key is new. Forwarded from actions/cache'
|
|
value: ${{ steps.hit.outputs.cache-hit }}
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- id: paths
|
|
run: |
|
|
[ "${{ inputs.cache-artifacts }}" = "true" ] && A_PATH="~/.julia/artifacts"
|
|
echo "artifacts-path=$A_PATH" >> $GITHUB_OUTPUT
|
|
[ "${{ inputs.cache-packages }}" = "true" ] && P_PATH="~/.julia/packages"
|
|
echo "packages-path=$P_PATH" >> $GITHUB_OUTPUT
|
|
[ "${{ inputs.cache-registries }}" = "true" ] && R_PATH="~/.julia/registries"
|
|
echo "registries-path=$R_PATH" >> $GITHUB_OUTPUT
|
|
[ "${{ inputs.cache-compiled }}" = "true" ] && PCC_PATH="~/.julia/compiled"
|
|
echo "precompilation-cache-path=$PCC_PATH" >> $GITHUB_OUTPUT
|
|
[ "${{ inputs.cache-scratchspaces }}" = "true" ] && S_PATH="~/.julia/scratchspaces"
|
|
echo "scratchspaces-path=$S_PATH" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
|
|
id: cache
|
|
with:
|
|
path: "${{ format('{0}\n{1}\n{2}\n{3}\n{4}', steps.paths.outputs.artifacts-path, steps.paths.outputs.packages-path, steps.paths.outputs.registries-path, steps.paths.outputs.precompilation-cache-path, steps.paths.outputs.scratchspaces-path) }}"
|
|
key: ${{ runner.os }}-${{ inputs.cache-name }}-${{ hashFiles('**/Project.toml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ inputs.cache-name }}-
|
|
|
|
- id: hit
|
|
run: echo "cache-hit=$CACHE_HIT" >> $GITHUB_OUTPUT
|
|
env:
|
|
CACHE_HIT: ${{ steps.cache.outputs.cache-hit }}
|
|
shell: bash
|