cache/README.md

53 lines
2.8 KiB
Markdown
Raw Normal View History

2024-02-15 19:33:19 +00:00
# Shockingly faster cache action
2019-10-30 18:48:49 +00:00
2024-05-21 18:59:39 +00:00
This action is a drop-in replacement for the official `actions/cache@v4` action, for use with the [RunsOn](https://runs-on.com/?ref=cache) self-hosted GitHub Action runner provider, or with your own self-hosted runner solution.
2019-10-30 18:48:49 +00:00
2024-02-15 19:33:19 +00:00
![image](https://github.com/runs-on/cache/assets/6114/e61c5b6f-aa86-48be-9e1b-baac6dce9b84)
GA for granular cache (#1035) * Add example for Haskell Stack * Revert "Add example for Haskell Stack" * Basic implementation * Updated variable name * Adding wrapper class * Changed logs to warnings * added debug logs * experimenting * Test * test * new try * test * Impl separated * Reverted wrapper changes * Added test cases * Some cleanup * Formatted document * Fixed test cases issues * Slight modification for test cases check * Updated new actions' input descriptions * Reverted custom asks implemented and added wrapper * refactor into a generic outputter * Readme draft for new actions * Generated dist * Fixed breaking test case * Removed return type in promise * Removed commented lines * Calling methods from same file * dist * update save as well * fix merge * Changes for beta release * Update dist folder * Fixed formatting * dist * Add support for gzip fallback for restore of old cache on windows * Fixed test cases * Fixed test cases * Added restore only and save only test cases * Updated new actions dist files * Removed comments * Fixed inputs * Renamed variables and added tests * Fixed breaking test case * Fixed review comments and tests * added stateprovider changes * Deleted stateprovider tests until added * Added stateprovider test cases * Fixed breaking test case * Updated outputs of restore action * Changes for beta release * Update dist folder * Add support for gzip fallback for restore of old cache on windows * update for new beta release * Update save/action.yml Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update restore/action.yml Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update restore/action.yml Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update restore/action.yml Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update restore/action.yml Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Added more assertions as values can't be checked * Removed unused code * Merged beta branch and resolved conflicts * Added save readme * Updates to save readme * Renamed output * Added cache hit info in readme * Update restore/README.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update restore/README.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update restore/README.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update save/README.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update save/README.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Removed verbose statements * Repositioned new actions introduction * Added test case for restore state * Addressed review comments * nit * nit: added language to code blocks * Updated beta version to 3.2.0-beta.1 * Added stateprovider mock implementations * Linting errors fixed * Save-only warning added * Updated return ID to -2 * Removed -2 error code * Removed comment * Updated cache npm lib version * Updated license version * Updated releases.md * Updated readme with the new actions in what's new Co-authored-by: Malo Bourgon <mbourgon@gmail.com> Co-authored-by: Vipul <vsvipul@github.com> Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> Co-authored-by: Tanuj Kumar Mishra <tanuj077@users.noreply.github.com> Co-authored-by: Sampark Sharma <phantsure@github.com>
2022-12-21 14:08:44 +00:00
2024-02-15 19:33:19 +00:00
It will automatically store your caches in a dedicated RunsOn S3 bucket that lives close to your self-hosted runners, ensuring you get at least 200MiB/s download and upload throughput when using caches in your workflows. The larger the cache, the faster the speed.
2024-02-15 19:33:19 +00:00
Also note that you no longer have any limit on the size of the cache. The bucket has a lifecycle rule to remove items older than 10 days.
2024-02-15 19:33:19 +00:00
If no S3 bucket is provided, it will also transparently switch to the default behaviour. This means you can use this action and switch between RunsOn runners and official GitHub runners with no change.
2024-02-15 19:33:19 +00:00
## Usage with RunsOn
Cache recipes for cache, restore and save actions (#1055) * Added outline and cache basics * Update CACHING.md * Added info about key and restore keys * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Review comments and some snippets * Updated doc with comments * Formatted sub headings * Markdown linting * Added paths * Fixed heading * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Updated paths * Renamed file and added readme reference * Fixed heading of a section * Update README.md * Moved back section to strategies * Reverted to older version * Fixed broken link Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2023-01-12 06:30:47 +00:00
2024-02-15 19:33:19 +00:00
If using [RunsOn](https://runs-on.com), simply replace `actions/cache@v4` with `runs-on/cache@v4`. All the official options are supported.
Cache recipes for cache, restore and save actions (#1055) * Added outline and cache basics * Update CACHING.md * Added info about key and restore keys * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Review comments and some snippets * Updated doc with comments * Formatted sub headings * Markdown linting * Added paths * Fixed heading * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Updated paths * Renamed file and added readme reference * Fixed heading of a section * Update README.md * Moved back section to strategies * Reverted to older version * Fixed broken link Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2023-01-12 06:30:47 +00:00
2024-02-15 19:33:19 +00:00
```diff
- - uses: actions/cache@v4
+ - uses: runs-on/cache@v4
with:
2024-02-15 19:33:19 +00:00
...
```
2024-02-15 19:33:19 +00:00
Please refer to [actions/cache](https://github.com/actions/cache) for usage.
2024-02-15 19:33:19 +00:00
## Usage outside RunsOn
2024-02-15 19:33:19 +00:00
If you want to use this in your own infrastructure, setup your AWS credentials with [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials), then:
Cache recipes for cache, restore and save actions (#1055) * Added outline and cache basics * Update CACHING.md * Added info about key and restore keys * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Review comments and some snippets * Updated doc with comments * Formatted sub headings * Markdown linting * Added paths * Fixed heading * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Updated paths * Renamed file and added readme reference * Fixed heading of a section * Update README.md * Moved back section to strategies * Reverted to older version * Fixed broken link Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2023-01-12 06:30:47 +00:00
2019-10-30 18:48:49 +00:00
```yaml
2024-02-15 19:33:19 +00:00
- uses: aws-actions/configure-aws-credentials@v4
...
- uses: runs-on/cache@v4
2019-10-30 18:48:49 +00:00
with:
2024-02-15 19:33:19 +00:00
...
env:
RUNS_ON_S3_BUCKET_CACHE: name-of-your-bucket
```
Cache recipes for cache, restore and save actions (#1055) * Added outline and cache basics * Update CACHING.md * Added info about key and restore keys * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Review comments and some snippets * Updated doc with comments * Formatted sub headings * Markdown linting * Added paths * Fixed heading * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update CACHING.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Updated paths * Renamed file and added readme reference * Fixed heading of a section * Update README.md * Moved back section to strategies * Reverted to older version * Fixed broken link Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2023-01-12 06:30:47 +00:00
2024-02-15 19:33:19 +00:00
Be aware of S3 transfer costs if your runners are not in the same AWS region as your bucket.
2024-05-21 16:29:45 +00:00
## Special environment variables
* `RUNS_ON_S3_BUCKET_CACHE`: if set, the action will use this bucket to store the cache.
2025-03-11 17:29:31 +00:00
* `RUNS_ON_S3_BUCKET_ENDPOINT`: if set, the action will use this endpoint to connect to the bucket. This is useful if you are using AWS's S3 transfer acceleration or a non-AWS S3-compatible service.
2024-05-21 18:59:39 +00:00
* `RUNS_ON_RUNNER_NAME`: when running on RunsOn, where this environment variable is non-empty, existing AWS credentials from the environment will be discarded. If you want to preserve existing environment variables, set this to the empty string `""`.
2024-05-21 16:29:45 +00:00
* `RUNS_ON_S3_FORCE_PATH_STYLE` or `AWS_S3_FORCE_PATH_STYLE`: if one of those environment variables equals the string `"true"`, then the S3 client will be configured to force the path style.
2025-10-14 18:56:58 +00:00
## Action pinning
Contrary to the upstream action, `v4` is a branch. As such, any tag pushed to this runs-on/cache repository comes from upstream and does NOT contain the changes for the S3 backend support. Please pin to a specific commmit from the `v4` branch if needed.