{"id":19235338,"url":"https://github.com/julia-actions/cache","last_synced_at":"2025-04-07T12:09:20.986Z","repository":{"id":39605052,"uuid":"441908600","full_name":"julia-actions/cache","owner":"julia-actions","description":"A shortcut action to cache Julia artifacts, packages, and registries.","archived":false,"fork":false,"pushed_at":"2024-05-01T16:53:51.000Z","size":93,"stargazers_count":37,"open_issues_count":20,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-05-01T17:43:51.749Z","etag":null,"topics":["actions","cache","github-actions","julia"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/julia-actions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-26T14:20:57.000Z","updated_at":"2024-06-28T12:28:59.176Z","dependencies_parsed_at":"2023-11-25T06:20:58.397Z","dependency_job_id":"db2447a6-ae50-4468-9d2b-8311d0aa84bd","html_url":"https://github.com/julia-actions/cache","commit_stats":{"total_commits":43,"total_committers":4,"mean_commits":10.75,"dds":0.4418604651162791,"last_synced_commit":"3ea06f8ffc7420583a26c12fa5a09e32a0f2d689"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julia-actions%2Fcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julia-actions%2Fcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julia-actions%2Fcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julia-actions%2Fcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/julia-actions","download_url":"https://codeload.github.com/julia-actions/cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648977,"owners_count":20972945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","cache","github-actions","julia"],"created_at":"2024-11-09T16:16:37.067Z","updated_at":"2025-04-07T12:09:20.974Z","avatar_url":"https://github.com/julia-actions.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# julia-actions/cache Action\n\nA shortcut action to cache Julia depot contents to reduce GitHub Actions running time.\n\n## Usage\n\nAn example workflow that uses this action might look like this:\n\n```yaml\nname: CI\n\non: [push, pull_request]\n\n# needed to allow julia-actions/cache to delete old caches that it has created\npermissions:\n  actions: write\n  contents: read\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - uses: julia-actions/setup-julia@v2\n    - uses: julia-actions/cache@v2\n    - uses: julia-actions/julia-buildpkg@v1\n    - uses: julia-actions/julia-runtest@v1\n```\n\nBy default all depot directories called out below are cached.\n\n### Requirements\n\n- `jq`: This action uses [`jq`](https://github.com/jqlang/jq) to parse JSON. For GitHub-hosted runners, `jq` is installed by default. On self-hosted runners and custom containers, if `jq` is not already available, this action will automatically use [`dcarbone/install-jq-action`](https://github.com/dcarbone/install-jq-action) to install `jq` (Note: `dcarbone/install-jq-action` requires that `curl` is installed; this may not always be the case in custom containers and self-hosted runners).\n- `bash`: This action requires `bash`. For GitHub-hosted runners `bash` is installed by default. Self-hosted runners will need to ensure that `bash` is installed and available on the `PATH`.\n\n### Optional Inputs\n\n- `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.\n- `include-matrix` - Whether to include the matrix values when constructing the cache key. Defaults to `true`.\n- `depot` - Path to a Julia [depot](https://pkgdocs.julialang.org/v1/glossary/) directory where cached data will be saved to and restored from. Defaults to the first depot in [`JULIA_DEPOT_PATH`](https://docs.julialang.org/en/v1/manual/environment-variables/#JULIA_DEPOT_PATH) if specified. Otherwise, defaults to `~/.julia`.\n- `cache-artifacts` - Whether to cache the depot's `artifacts` directory. Defaults to `true`.\n- `cache-packages` - Whether to cache the depot's `packages` directory. Defaults to `true`.\n- `cache-registries` - Whether to cache the depot's `registries` directory. Defaults to `true`.\n- `cache-compiled` - Whether to cache the depot's `compiled` directory. Defaults to `true`.\n- `cache-scratchspaces` - Whether to cache the depot's `scratchspaces` directory. Defaults to `true`.\n- `cache-logs` - Whether to cache the depot's `logs` directory. Defaults to `true`. Helps auto-`Pkg.gc()` keep the cache small.\n- `delete-old-caches` - Whether to delete old caches for the given key. Defaults to `true`.\n- `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.\n\n### Outputs\n\n- `cache-hit` - A boolean value to indicate an exact match was found for the primary key. Returns \\\"\\\" when the key is new. Forwarded from actions/cache.\n- `cache-paths` - A list of paths (as a newline-separated string) that were cached.\n- `cache-key` - The cache key that was used for this run.\n\n## How It Works\n\nThis action is a wrapper around \u003chttps://github.com/actions/cache\u003e.\nIn summary, this action stores the files in the aforementioned paths in one compressed file when running for the first time.\nThis cached file is then restored upon the second run, and afterwards resaved under a new key, and the previous cache deleted.\nThe benefit of caching is that downloading one big file is quicker than downloading many different files from many different locations\nand precompiling them.\n\nBy default, this action removes caches that were previously made by jobs on the same branch with the same restore key.\nGitHub automatically removes old caches after a certain period or when the repository cache allocation is full.\nIt is, however, more efficient to explicitly remove old caches to improve caching for less frequently run jobs.\n\nFor more information about GitHub caching generically, for example how to manually delete caches, see\n[this GitHub documentation page](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#managing-caches).\n\n### Cache keys\n\nThe cache key that the cache will be saved as is based on:\n- The `cache-name` input\n- All variables in the `matrix` (unless disabled via `include-matrix: 'false'`)\n- The `runner.os` (may be in the matrix too, but included for safety)\n- The run id\n- The run attempt number\n\n\u003e [!NOTE]\n\u003e If there is job concurrency that is not fully defined by a matrix you should ensure that `cache-name` is \n\u003e unique for each concurrent job, otherwise caching may not be effective.\n\n### Cache Retention\n\nThis action automatically deletes old caches that match the first 4 fields of the above key:\n- The `cache-name` input\n- All variables in the `matrix` (unless disabled via `include-matrix: 'false'`)\n- The `runner.os` (may be in the matrix too, but included for safety)\n\nWhich means your caches files will not grow needlessly. GitHub also deletes cache files after\n[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.\n\n\u003e [!NOTE]\n\u003e 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)\n\u003e to the `GITHUB_TOKEN` by adding this to your GitHub actions workflow:\n\u003e ```yaml\n\u003e permissions:\n\u003e   actions: write\n\u003e   contents: read\n\u003e ```\n\u003e (Note this won't work for fork PRs but should once merged)\n\u003e Or provide a token with `repo` scope via the `token` input option.\n\u003e See https://cli.github.com/manual/gh_cache_delete\n\nTo disable deletion set input `delete-old-caches: 'false'`.\n\n### Caching even if an intermediate job fails\n\nJust like [the basic actions/cache workflow](https://github.com/actions/cache), this action has a cache restore step, and also a save step which runs after the workflow completes.\nBy default, if any job in the workflow fails, the entire workflow will be stopped, and the cache will not be saved.\n\nDue to current limitations in GitHub Actions syntax, there is no built-in option for this action to save the cache even if the job fails.\nHowever, it does output information which you can feed into `actions/cache` yourself to achieve the same effect.\nFor example, this workflow will ensure that the cache is saved if a step fails (but skipping it if the cache was hit, i.e. there's no need to cache it again).\n\n```yaml\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Load Julia packages from cache\n        id: julia-cache\n        uses: julia-actions/cache@v2\n        with:\n          cache-name: foo\n\n      # do whatever you want here (that might fail)\n\n      - name: Save Julia depot cache on failure\n        id: julia-cache-save\n        if: failure() \u0026\u0026 steps.julia-cache.outputs.cache-hit != 'true'\n        uses: actions/cache/save@v4\n        with: \n          path: |\n            ${{ steps.julia-cache.outputs.cache-paths }}\n          key: ${{ steps.julia-cache.outputs.cache-key }}\n```\n\n### Cache Garbage Collection\n\nCaches are restored and re-saved after every run, retaining the state of the depot throughout runs.\nTheir size will be regulated like a local depot automatically by the automatic `Pkg.gc()` functionality that\nclears out old content, which is made possible because the `/log` contents are cached.\n\n## Third Party Notice\n\nThis action is built around [`actions/cache`](https://github.com/actions/cache/) and includes parts of that action. `actions/cache` has been released under the following licence:\n\n\u003e The MIT License (MIT)\n\u003e\n\u003e Copyright (c) 2018 GitHub, Inc. and contributors\n\u003e\n\u003e Permission is hereby granted, free of charge, to any person obtaining a copy\n\u003e of this software and associated documentation files (the \"Software\"), to deal\n\u003e in the Software without restriction, including without limitation the rights\n\u003e to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\u003e copies of the Software, and to permit persons to whom the Software is\n\u003e furnished to do so, subject to the following conditions:\n\u003e\n\u003e The above copyright notice and this permission notice shall be included in\n\u003e all copies or substantial portions of the Software.\n\u003e\n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\u003e IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\u003e FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\u003e AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\u003e LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\u003e OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\u003e THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulia-actions%2Fcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjulia-actions%2Fcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulia-actions%2Fcache/lists"}