mirror of
https://github.com/julia-actions/cache.git
synced 2026-02-13 01:46:52 +08:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d48542bb7b | ||
|
|
caa655642c | ||
|
|
1c20782198 | ||
|
|
4b23ab708f | ||
|
|
cc87ef305e | ||
|
|
c36389738b | ||
|
|
1b0706c0c7 | ||
|
|
8b63b4a15d | ||
|
|
0413f3b1ae | ||
|
|
e8521d4bd2 | ||
|
|
b1b004ffca | ||
|
|
216aaef29a | ||
|
|
3e0649aaee |
13
.github/dependabot.yml
vendored
13
.github/dependabot.yml
vendored
@@ -1,9 +1,10 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
|
||||
# Keep dependencies for GitHub Actions up-to-date
|
||||
- package-ecosystem: 'github-actions'
|
||||
directory: '/'
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
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:
|
||||
JULIA_DEPOT_PATH: /tmp/julia-depot
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||
- name: Set cache-name
|
||||
id: cache-name
|
||||
shell: bash
|
||||
run: |
|
||||
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:
|
||||
version: ${{ matrix.version }}
|
||||
- name: Save cache
|
||||
@@ -117,8 +117,8 @@ jobs:
|
||||
env:
|
||||
JULIA_DEPOT_PATH: /tmp/julia-depot
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
- uses: julia-actions/setup-julia@v1
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||
- uses: julia-actions/setup-julia@v2
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- name: Restore cache
|
||||
@@ -161,7 +161,7 @@ jobs:
|
||||
outputs:
|
||||
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||
- name: Set cache-name
|
||||
id: cache-name
|
||||
run: |
|
||||
@@ -193,7 +193,7 @@ jobs:
|
||||
needs: test-save-nomatrix
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||
- name: Restore cache
|
||||
id: cache
|
||||
uses: ./
|
||||
@@ -233,7 +233,7 @@ jobs:
|
||||
outputs:
|
||||
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||
- name: Set cache-name
|
||||
id: cache-name
|
||||
run: |
|
||||
@@ -259,7 +259,7 @@ jobs:
|
||||
needs: test-save-cloned-registry
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
||||
- name: Add General registry clone
|
||||
shell: julia --color=yes {0}
|
||||
run: |
|
||||
|
||||
15
README.md
15
README.md
@@ -21,7 +21,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: julia-actions/setup-julia@v1
|
||||
- uses: julia-actions/setup-julia@v2
|
||||
- uses: julia-actions/cache@v1
|
||||
- uses: julia-actions/julia-buildpkg@v1
|
||||
- uses: julia-actions/julia-runtest@v1
|
||||
@@ -29,6 +29,13 @@ jobs:
|
||||
|
||||
By default all depot directories called out below are cached.
|
||||
|
||||
### Requirements
|
||||
|
||||
This action uses [`jq`](https://github.com/jqlang/jq) to parse JSON.
|
||||
`jq` is installed by default in GitHub-hosted runners.
|
||||
[`dcarbone/install-jq-action`](https://github.com/dcarbone/install-jq-action) is used to check that `jq` is available and install it if not.
|
||||
**Note:** installing `jq` with `dcarbone/install-jq-action` requires that curl is available; this may not be the case in custom containers.
|
||||
|
||||
### Optional Inputs
|
||||
|
||||
- `cache-name` - The cache key prefix. Defaults to `julia-cache;workflow=${{ github.workflow }};job=${{ github.job }}`. The key body automatically includes the OS and, unless disabled with `include-matrix`, the matrix vars. Include any other parameters/details in this prefix to ensure one unique cache key per concurrent job type.
|
||||
@@ -55,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
|
||||
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
|
||||
|
||||
The cache key that the cache will be saved as is based on:
|
||||
@@ -76,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)
|
||||
|
||||
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]
|
||||
> 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)
|
||||
|
||||
11
action.yml
11
action.yml
@@ -52,10 +52,7 @@ runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Install jq
|
||||
# Skip installation on GitHub-hosted runners:
|
||||
# https://github.com/orgs/community/discussions/48359#discussioncomment-5323864
|
||||
if: ${{ !startsWith(runner.name, 'GitHub Actions') }}
|
||||
uses: dcarbone/install-jq-action@v2.1.0
|
||||
uses: dcarbone/install-jq-action@8867ddb4788346d7c22b72ea2e2ffe4d514c7bcb
|
||||
with:
|
||||
force: false # Skip install when an existing `jq` is present
|
||||
|
||||
@@ -118,7 +115,7 @@ runs:
|
||||
env:
|
||||
MATRIX_JSON: ${{ toJSON(matrix) }}
|
||||
|
||||
- uses: actions/cache@4d4ae6ae148a43d0fd1eda1800170683e9882738
|
||||
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
||||
id: cache
|
||||
with:
|
||||
path: |
|
||||
@@ -139,7 +136,7 @@ runs:
|
||||
# that match the restore key just before saving the new cache
|
||||
|
||||
# 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' }}
|
||||
with:
|
||||
# seems like there has to be a `main` step in this action. Could list caches for info if we wanted
|
||||
@@ -150,7 +147,7 @@ runs:
|
||||
GH_TOKEN: ${{ inputs.token }}
|
||||
|
||||
# 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' }}
|
||||
with:
|
||||
main: echo ""
|
||||
|
||||
Reference in New Issue
Block a user