Compare commits

..

3 Commits

Author SHA1 Message Date
Ian Butterworth
64e2b31172 update to actions/cache v4.0.2 commit 2024-04-03 12:21:49 -04:00
Ian Butterworth
5898e5c965 Apply suggestions from code review
Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>
2024-01-23 12:11:22 -05:00
Ian Butterworth
1470e42d30 add save-always 2024-01-18 10:26:13 -05:00
4 changed files with 24 additions and 24 deletions

View File

@@ -1,10 +1,9 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
# Keep dependencies for GitHub Actions up-to-date
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "monthly"
open-pull-requests-limit: 99
labels:
- "dependencies"
- "github-actions"
interval: 'daily'

View File

@@ -59,13 +59,13 @@ jobs:
env:
JULIA_DEPOT_PATH: /tmp/julia-depot
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- 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@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
- name: Save cache
@@ -117,8 +117,8 @@ jobs:
env:
JULIA_DEPOT_PATH: /tmp/julia-depot
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
- uses: julia-actions/setup-julia@v2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: julia-actions/setup-julia@v1
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@0ad4b8fadaa221de15dcec353f45205ec38ea70b
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Restore cache
id: cache
uses: ./
@@ -233,7 +233,7 @@ jobs:
outputs:
cache-name: ${{ steps.cache-name.outputs.cache-name }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Add General registry clone
shell: julia --color=yes {0}
run: |

View File

@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
@@ -47,6 +47,7 @@ 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-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.
- `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`.
- `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.
@@ -62,10 +63,6 @@ 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:
@@ -87,7 +84,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
[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.
[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)
> [!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)

View File

@@ -36,6 +36,9 @@ inputs:
cache-logs:
description: Whether to cache the depot's `logs` directory. This helps automatic `Pkg.gc()` keep the cache size down.
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:
description: Whether to delete old caches for the given key.
default: 'true'
@@ -52,7 +55,7 @@ runs:
using: 'composite'
steps:
- name: Install jq
uses: dcarbone/install-jq-action@8867ddb4788346d7c22b72ea2e2ffe4d514c7bcb
uses: dcarbone/install-jq-action@8867ddb4788346d7c22b72ea2e2ffe4d514c7bcb # v2.1.0
with:
force: false # Skip install when an existing `jq` is present
@@ -123,6 +126,7 @@ runs:
key: ${{ steps.keys.outputs.key }}
restore-keys: ${{ steps.keys.outputs.restore-key }}
enableCrossOsArchive: false
save-always: ${{ inputs.save-always }}
# 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
@@ -136,7 +140,7 @@ runs:
# that match the restore key just before saving the new cache
# Not windows
- uses: pyTooling/Actions/with-post-step@e9d0dc3dba9fda45f195946858708f60c0240caf # v1.0.5
- uses: pyTooling/Actions/with-post-step@adef08d3bdef092282614f3b683897cefae82ee3
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
@@ -147,7 +151,7 @@ runs:
GH_TOKEN: ${{ inputs.token }}
# Windows (because this action uses command prompt on windows)
- uses: pyTooling/Actions/with-post-step@e9d0dc3dba9fda45f195946858708f60c0240caf # v1.0.5
- uses: pyTooling/Actions/with-post-step@adef08d3bdef092282614f3b683897cefae82ee3
if: ${{ inputs.delete-old-caches != 'false' && runner.OS == 'Windows' }}
with:
main: echo ""