mirror of
https://github.com/julia-actions/cache.git
synced 2026-02-12 17:36:53 +08:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
569d290d51 | ||
|
|
47d045b35a | ||
|
|
edf78a706c | ||
|
|
10913c2628 | ||
|
|
a364403e9b | ||
|
|
b695972eeb | ||
|
|
2ff65c9241 | ||
|
|
8618676e71 | ||
|
|
6bbc93575c | ||
|
|
a96f53eeda | ||
|
|
bb2ad8a6dc | ||
|
|
b45946153f | ||
|
|
26bda12c02 | ||
|
|
08f6ca9894 | ||
|
|
d696810071 | ||
|
|
643194b98c | ||
|
|
c314effe59 | ||
|
|
c38652fe18 |
13
.github/workflows/CI.yml
vendored
13
.github/workflows/CI.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
run: 'write("random.txt", string(rand(10)))'
|
||||
- name: Set cache-name as output
|
||||
id: name
|
||||
run: echo "::set-output name=cache-name::${{ hashFiles('random.txt') }}"
|
||||
run: echo "cache-name=${{ hashFiles('random.txt') }}" >> $GITHUB_OUTPUT
|
||||
|
||||
test-save:
|
||||
needs: generate-key
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
|
||||
- name: Save cache
|
||||
id: cache
|
||||
uses: ./
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
|
||||
- name: Restore cache
|
||||
id: cache
|
||||
uses: ./
|
||||
@@ -69,11 +69,16 @@ jobs:
|
||||
@assert ENV["cache-hit"] == "true"
|
||||
env:
|
||||
cache-hit: ${{ steps.cache.outputs.cache-hit }}
|
||||
- name: Check non-empty artifacts and packages dir
|
||||
- name: Check existance or emptiness of affected dirs
|
||||
shell: 'julia --color=yes {0}'
|
||||
run: |
|
||||
# Artifacts and Packages should exist as they've been cached
|
||||
artifacts_dir = joinpath(first(DEPOT_PATH), "artifacts")
|
||||
@assert !isempty(readdir(artifacts_dir))
|
||||
packages_dir = joinpath(first(DEPOT_PATH), "packages")
|
||||
@assert !isempty(readdir(packages_dir))
|
||||
|
||||
# Caching the compiled dir is disabled by default and should not exist after restoring a cache
|
||||
compiled_dir = joinpath(first(DEPOT_PATH), "compiled")
|
||||
@assert !isdir(compiled_dir) || isempty(readdir(compiled_dir))
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ That is why caching the registries is disabled by default.
|
||||
- `cache-artifacts` - Whether to cache `~/.julia/artifacts/`. Enabled by default.
|
||||
- `cache-packages` - Whether to cache `~/.julia/packages/`. Enabled by default.
|
||||
- `cache-registries` - Whether to cache `~/.julia/registries/`. Disabled by default.
|
||||
- `cache-compiled` - Whether to cache `~/.julia/compiled/`. Disabled by default. **USE ONLY IF YOU KNOW WHAT YOU'RE DOING!** See [#11](https://github.com/julia-actions/cache/issues/11).
|
||||
|
||||
### Outputs
|
||||
|
||||
|
||||
11
action.yml
11
action.yml
@@ -19,6 +19,9 @@ inputs:
|
||||
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'
|
||||
|
||||
outputs:
|
||||
cache-hit:
|
||||
@@ -36,18 +39,20 @@ runs:
|
||||
echo "PACKAGES_PATH=$P_PATH" >> $GITHUB_ENV
|
||||
[ "${{ inputs.cache-registries }}" = "true" ] && R_PATH="~/.julia/registries"
|
||||
echo "REGISTRIES_PATH=$R_PATH" >> $GITHUB_ENV
|
||||
[ "${{ inputs.cache-compiled }}" = "true" ] && PCC_PATH="~/.julia/compiled"
|
||||
echo "PRECOMPILATION_CACHE_PATH=$PCC_PATH" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
|
||||
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
||||
id: cache
|
||||
with:
|
||||
path: "${{ format('{0}\n{1}\n{2}', env.ARTIFACTS_PATH, env.PACKAGES_PATH, env.REGISTRIES_PATH) }}"
|
||||
path: "${{ format('{0}\n{1}\n{2}\n{3}', env.ARTIFACTS_PATH, env.PACKAGES_PATH, env.REGISTRIES_PATH, env.PRECOMPILATION_CACHE_PATH) }}"
|
||||
key: ${{ runner.os }}-test-${{ inputs.cache-name }}-${{ hashFiles('**/Project.toml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-test-${{ inputs.cache-name }}-
|
||||
|
||||
- id: hit
|
||||
run: echo "::set-output name=cache-hit::$(echo $CACHE_HIT)"
|
||||
run: echo "cache-hit=$CACHE_HIT" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
CACHE_HIT: ${{ steps.cache.outputs.cache-hit }}
|
||||
shell: bash
|
||||
|
||||
Reference in New Issue
Block a user