mirror of
https://github.com/julia-actions/cache.git
synced 2026-02-13 09:46:52 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
824243901f | ||
|
|
8608484607 | ||
|
|
e662c42397 | ||
|
|
e7913c2cb9 | ||
|
|
9ec3abbd64 |
12
.github/workflows/CI.yml
vendored
12
.github/workflows/CI.yml
vendored
@@ -59,7 +59,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
JULIA_DEPOT_PATH: /tmp/julia-depot
|
JULIA_DEPOT_PATH: /tmp/julia-depot
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||||
- name: Set cache-name
|
- name: Set cache-name
|
||||||
id: cache-name
|
id: cache-name
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -117,7 +117,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
JULIA_DEPOT_PATH: /tmp/julia-depot
|
JULIA_DEPOT_PATH: /tmp/julia-depot
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||||
- uses: julia-actions/setup-julia@v2
|
- uses: julia-actions/setup-julia@v2
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
@@ -161,7 +161,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||||
- name: Set cache-name
|
- name: Set cache-name
|
||||||
id: cache-name
|
id: cache-name
|
||||||
run: |
|
run: |
|
||||||
@@ -193,7 +193,7 @@ jobs:
|
|||||||
needs: test-save-nomatrix
|
needs: test-save-nomatrix
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||||
- name: Restore cache
|
- name: Restore cache
|
||||||
id: cache
|
id: cache
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -233,7 +233,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||||
- name: Set cache-name
|
- name: Set cache-name
|
||||||
id: cache-name
|
id: cache-name
|
||||||
run: |
|
run: |
|
||||||
@@ -259,7 +259,7 @@ jobs:
|
|||||||
needs: test-save-cloned-registry
|
needs: test-save-cloned-registry
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||||
- name: Add General registry clone
|
- name: Add General registry clone
|
||||||
shell: julia --color=yes {0}
|
shell: julia --color=yes {0}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
24
action.yml
24
action.yml
@@ -66,6 +66,11 @@ runs:
|
|||||||
else
|
else
|
||||||
depot="~/.julia"
|
depot="~/.julia"
|
||||||
fi
|
fi
|
||||||
|
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
|
||||||
|
depot="${depot/#\~/$USERPROFILE}" # Windows paths
|
||||||
|
else
|
||||||
|
depot="${depot/#\~/$HOME}" # Unix-like paths
|
||||||
|
fi
|
||||||
echo "depot=$depot" | tee -a "$GITHUB_OUTPUT"
|
echo "depot=$depot" | tee -a "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
cache_paths=()
|
cache_paths=()
|
||||||
@@ -75,7 +80,7 @@ runs:
|
|||||||
[ "${{ inputs.cache-packages }}" = "true" ] && cache_paths+=("$packages_path")
|
[ "${{ inputs.cache-packages }}" = "true" ] && cache_paths+=("$packages_path")
|
||||||
registries_path="${depot}/registries"
|
registries_path="${depot}/registries"
|
||||||
if [ "${{ inputs.cache-registries }}" = "true" ]; then
|
if [ "${{ inputs.cache-registries }}" = "true" ]; then
|
||||||
if [ ! -d "${registries_path/#\~/$HOME}" ]; then
|
if [ ! -d "${registries_path}" ]; then
|
||||||
cache_paths+=("$registries_path")
|
cache_paths+=("$registries_path")
|
||||||
else
|
else
|
||||||
echo "::warning::Julia depot registries already exist. Skipping restoring of cached registries to avoid potential merge conflicts when updating. Please ensure that \`julia-actions/cache\` precedes any workflow steps which add registries."
|
echo "::warning::Julia depot registries already exist. Skipping restoring of cached registries to avoid potential merge conflicts when updating. Please ensure that \`julia-actions/cache\` precedes any workflow steps which add registries."
|
||||||
@@ -132,6 +137,23 @@ runs:
|
|||||||
du -shc ${{ steps.paths.outputs.depot }}/* || true
|
du -shc ${{ steps.paths.outputs.depot }}/* || true
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
# issue https://github.com/julia-actions/cache/issues/110
|
||||||
|
# Pkg may not run `Registry.update()` if a manifest exists, which may exist because of a
|
||||||
|
# `Pkg.dev` call or because one is added to the repo. So be safe and update cached registries here.
|
||||||
|
# Older (~v1.0) versions of julia that don't have `Pkg.Registry.update()` seem to always update registries in
|
||||||
|
# Pkg operations. So this is only necessary for newer julia versions.
|
||||||
|
- name: Update any cached registries
|
||||||
|
if: ${{ inputs.cache-registries == 'true' }}
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
if [ -d "${{ steps.paths.outputs.depot }}/registries" ] && [ -n "$(ls -A "${{ steps.paths.outputs.depot }}/registries")" ]; then
|
||||||
|
echo "Registries directory exists and is non-empty. Updating any registries"
|
||||||
|
julia -e "import Pkg; isdefined(Pkg, :Registry) && Pkg.Registry.update();"
|
||||||
|
else
|
||||||
|
echo "Registries directory does not exist or is empty. Skipping registry update"
|
||||||
|
fi
|
||||||
|
shell: bash
|
||||||
|
|
||||||
# GitHub actions cache entries are immutable and cannot be updated. In order to have both the Julia
|
# GitHub actions cache entries are immutable and cannot be updated. In order to have both the Julia
|
||||||
# depot cache be up-to-date and avoid storing redundant cache entries we'll manually cleanup old
|
# depot cache be up-to-date and avoid storing redundant cache entries we'll manually cleanup old
|
||||||
# cache entries before the new cache is saved. However, we need to be careful with our manual
|
# cache entries before the new cache is saved. However, we need to be careful with our manual
|
||||||
|
|||||||
Reference in New Issue
Block a user