mirror of
https://github.com/julia-actions/cache.git
synced 2026-02-14 01:56:54 +08:00
Compare commits
11 Commits
ib/always_
...
v2.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d48542bb7b | ||
|
|
caa655642c | ||
|
|
1c20782198 | ||
|
|
4b23ab708f | ||
|
|
cc87ef305e | ||
|
|
c36389738b | ||
|
|
1b0706c0c7 | ||
|
|
8b63b4a15d | ||
|
|
0413f3b1ae | ||
|
|
e8521d4bd2 | ||
|
|
b1b004ffca |
13
.github/dependabot.yml
vendored
13
.github/dependabot.yml
vendored
@@ -1,9 +1,10 @@
|
|||||||
version: 2
|
version: 2
|
||||||
|
|
||||||
updates:
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
# Keep dependencies for GitHub Actions up-to-date
|
directory: "/"
|
||||||
- package-ecosystem: 'github-actions'
|
|
||||||
directory: '/'
|
|
||||||
schedule:
|
schedule:
|
||||||
interval: 'daily'
|
interval: "monthly"
|
||||||
|
open-pull-requests-limit: 99
|
||||||
|
labels:
|
||||||
|
- "dependencies"
|
||||||
|
- "github-actions"
|
||||||
|
|||||||
16
.github/workflows/CI.yml
vendored
16
.github/workflows/CI.yml
vendored
@@ -59,13 +59,13 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
JULIA_DEPOT_PATH: /tmp/julia-depot
|
JULIA_DEPOT_PATH: /tmp/julia-depot
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||||
- name: Set cache-name
|
- name: Set cache-name
|
||||||
id: cache-name
|
id: cache-name
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "cache-name=${{ needs.generate-prefix.outputs.cache-prefix }}-${{ github.job }}" >>"$GITHUB_OUTPUT"
|
echo "cache-name=${{ needs.generate-prefix.outputs.cache-prefix }}-${{ github.job }}" >>"$GITHUB_OUTPUT"
|
||||||
- uses: julia-actions/setup-julia@v1
|
- uses: julia-actions/setup-julia@v2
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Save cache
|
- name: Save cache
|
||||||
@@ -117,8 +117,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
JULIA_DEPOT_PATH: /tmp/julia-depot
|
JULIA_DEPOT_PATH: /tmp/julia-depot
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||||
- uses: julia-actions/setup-julia@v1
|
- uses: julia-actions/setup-julia@v2
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Restore cache
|
- name: Restore cache
|
||||||
@@ -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@b4ffde65f46336ab88eb53be808477a3936bae11
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||||
- 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@b4ffde65f46336ab88eb53be808477a3936bae11
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||||
- 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@b4ffde65f46336ab88eb53be808477a3936bae11
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||||
- 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@b4ffde65f46336ab88eb53be808477a3936bae11
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||||
- name: Add General registry clone
|
- name: Add General registry clone
|
||||||
shell: julia --color=yes {0}
|
shell: julia --color=yes {0}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: julia-actions/setup-julia@v1
|
- uses: julia-actions/setup-julia@v2
|
||||||
- uses: julia-actions/cache@v1
|
- uses: julia-actions/cache@v1
|
||||||
- uses: julia-actions/julia-buildpkg@v1
|
- uses: julia-actions/julia-buildpkg@v1
|
||||||
- uses: julia-actions/julia-runtest@v1
|
- uses: julia-actions/julia-runtest@v1
|
||||||
@@ -47,7 +47,6 @@ This action uses [`jq`](https://github.com/jqlang/jq) to parse JSON.
|
|||||||
- `cache-compiled` - Whether to cache the depot's `compiled` directory. Defaults to `true`.
|
- `cache-compiled` - Whether to cache the depot's `compiled` directory. Defaults to `true`.
|
||||||
- `cache-scratchspaces` - Whether to cache the depot's `scratchspaces` directory. Defaults to `true`.
|
- `cache-scratchspaces` - Whether to cache the depot's `scratchspaces` directory. Defaults to `true`.
|
||||||
- `cache-logs` - Whether to cache the depot's `logs` directory. Defaults to `true`. Helps auto-`Pkg.gc()` keep the cache small.
|
- `cache-logs` - Whether to cache the depot's `logs` directory. Defaults to `true`. Helps auto-`Pkg.gc()` keep the cache small.
|
||||||
- `save-always` - Whether to save the cache even when the job fails. Defaults to `true`. This is useful as the Julia depot should mostly be reusable from a failing job.
|
|
||||||
- `delete-old-caches` - Whether to delete old caches for the given key. Defaults to `true`.
|
- `delete-old-caches` - Whether to delete old caches for the given key. Defaults to `true`.
|
||||||
- `token` - A [GitHub PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). Defaults to `github.token`. Requires `repo` scope to enable the deletion of old caches.
|
- `token` - A [GitHub PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). Defaults to `github.token`. Requires `repo` scope to enable the deletion of old caches.
|
||||||
|
|
||||||
@@ -63,6 +62,10 @@ This cached file is then restored upon the second run, and afterwards resaved un
|
|||||||
The benefit of caching is that downloading one big file is quicker than downloading many different files from many different locations
|
The benefit of caching is that downloading one big file is quicker than downloading many different files from many different locations
|
||||||
and precompiling them.
|
and precompiling them.
|
||||||
|
|
||||||
|
By default, this action removes caches that were previously made by jobs on the same branch with the same restore key.
|
||||||
|
GitHub automatically removes old caches after a certain period or when the repository cache allocation is full.
|
||||||
|
It is, however, more efficient to explicitly remove old caches to improve caching for less frequently run jobs.
|
||||||
|
|
||||||
### Cache keys
|
### Cache keys
|
||||||
|
|
||||||
The cache key that the cache will be saved as is based on:
|
The cache key that the cache will be saved as is based on:
|
||||||
@@ -84,7 +87,7 @@ This action automatically deletes old caches that match the first 4 fields of th
|
|||||||
- The `runner.os` (may be in the matrix too, but included for safety)
|
- The `runner.os` (may be in the matrix too, but included for safety)
|
||||||
|
|
||||||
Which means your caches files will not grow needlessly. GitHub also deletes cache files after
|
Which means your caches files will not grow needlessly. GitHub also deletes cache files after
|
||||||
[90 days which can be increased in private repos to up to 400 days](https://docs.github.com/en/organizations/managing-organization-settings/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-organization)
|
[7 days of not being accessed](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy), and there is a limit of 10 GB for the total size of cache files associated to each repository.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> To allow deletion of caches you will likely need to [grant the following permissions](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs)
|
> To allow deletion of caches you will likely need to [grant the following permissions](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs)
|
||||||
|
|||||||
10
action.yml
10
action.yml
@@ -36,9 +36,6 @@ inputs:
|
|||||||
cache-logs:
|
cache-logs:
|
||||||
description: Whether to cache the depot's `logs` directory. This helps automatic `Pkg.gc()` keep the cache size down.
|
description: Whether to cache the depot's `logs` directory. This helps automatic `Pkg.gc()` keep the cache size down.
|
||||||
default: 'true'
|
default: 'true'
|
||||||
save-always:
|
|
||||||
description: Whether to save the cache even when the job fails. This is useful as the Julia depot should mostly be reusable from a failing job.
|
|
||||||
default: 'true'
|
|
||||||
delete-old-caches:
|
delete-old-caches:
|
||||||
description: Whether to delete old caches for the given key.
|
description: Whether to delete old caches for the given key.
|
||||||
default: 'true'
|
default: 'true'
|
||||||
@@ -55,7 +52,7 @@ runs:
|
|||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: Install jq
|
- name: Install jq
|
||||||
uses: dcarbone/install-jq-action@8867ddb4788346d7c22b72ea2e2ffe4d514c7bcb # v2.1.0
|
uses: dcarbone/install-jq-action@8867ddb4788346d7c22b72ea2e2ffe4d514c7bcb
|
||||||
with:
|
with:
|
||||||
force: false # Skip install when an existing `jq` is present
|
force: false # Skip install when an existing `jq` is present
|
||||||
|
|
||||||
@@ -126,7 +123,6 @@ runs:
|
|||||||
key: ${{ steps.keys.outputs.key }}
|
key: ${{ steps.keys.outputs.key }}
|
||||||
restore-keys: ${{ steps.keys.outputs.restore-key }}
|
restore-keys: ${{ steps.keys.outputs.restore-key }}
|
||||||
enableCrossOsArchive: false
|
enableCrossOsArchive: false
|
||||||
save-always: ${{ inputs.save-always }}
|
|
||||||
|
|
||||||
# if it wasn't restored make the depot anyway as a signal that this action ran
|
# if it wasn't restored make the depot anyway as a signal that this action ran
|
||||||
# for other julia actions to check, like https://github.com/julia-actions/julia-buildpkg/pull/41
|
# for other julia actions to check, like https://github.com/julia-actions/julia-buildpkg/pull/41
|
||||||
@@ -140,7 +136,7 @@ runs:
|
|||||||
# that match the restore key just before saving the new cache
|
# that match the restore key just before saving the new cache
|
||||||
|
|
||||||
# Not windows
|
# Not windows
|
||||||
- uses: pyTooling/Actions/with-post-step@adef08d3bdef092282614f3b683897cefae82ee3
|
- uses: pyTooling/Actions/with-post-step@e9d0dc3dba9fda45f195946858708f60c0240caf # v1.0.5
|
||||||
if: ${{ inputs.delete-old-caches != 'false' && runner.OS != 'Windows' }}
|
if: ${{ inputs.delete-old-caches != 'false' && runner.OS != 'Windows' }}
|
||||||
with:
|
with:
|
||||||
# seems like there has to be a `main` step in this action. Could list caches for info if we wanted
|
# seems like there has to be a `main` step in this action. Could list caches for info if we wanted
|
||||||
@@ -151,7 +147,7 @@ runs:
|
|||||||
GH_TOKEN: ${{ inputs.token }}
|
GH_TOKEN: ${{ inputs.token }}
|
||||||
|
|
||||||
# Windows (because this action uses command prompt on windows)
|
# Windows (because this action uses command prompt on windows)
|
||||||
- uses: pyTooling/Actions/with-post-step@adef08d3bdef092282614f3b683897cefae82ee3
|
- uses: pyTooling/Actions/with-post-step@e9d0dc3dba9fda45f195946858708f60c0240caf # v1.0.5
|
||||||
if: ${{ inputs.delete-old-caches != 'false' && runner.OS == 'Windows' }}
|
if: ${{ inputs.delete-old-caches != 'false' && runner.OS == 'Windows' }}
|
||||||
with:
|
with:
|
||||||
main: echo ""
|
main: echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user