From 5294b3f306918b313ba159be1aa3173e6049dfb9 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar Date: Wed, 19 Oct 2022 00:41:06 +0530 Subject: [PATCH 1/5] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index abe42b0..cbf27b4 100644 --- a/README.md +++ b/README.md @@ -34,17 +34,18 @@ If you are using this inside a container, a POSIX-compliant `tar` needs to be in * `path` - A list of files, directories, and wildcard patterns to cache and restore. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns. * `key` - An explicit key for restoring and saving the cache -* `restore-keys` - An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key. Note -`cache-hit` returns false in this case. +* `restore-keys` - An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key. #### Environment Variables * `SEGMENT_DOWNLOAD_TIMEOUT_MINS` - Segment download timeout (in minutes, default `60`) to abort download of the segment if not completed in the defined number of minutes. [Read more](#cache-segment-restore-timeout) ### Outputs -* `cache-hit` - A boolean value to indicate an exact match was found for the key +* `cache-hit` - A boolean value to indicate an exact match was found for the key. -> See [Skipping steps based on cache-hit](#Skipping-steps-based-on-cache-hit) for info on using this output +> Note: `cache-hit` will be set to `true` only when cache hit occurs for the exact `key` match. For a partial key match via `restore-keys` or a cache miss, it will be set to `false`. It is recommended to install the missing/updated dependencies in case of a partial key match when the key is dependent on the `hash` of the package file. + +See [Skipping steps based on cache-hit](#skipping-steps-based-on-cache-hit) for info on using this output ### Cache scopes The cache is scoped to the key and branch. The default branch cache is available to other branches. From 76639bb4e517ef889f653f786e0622f788a7f546 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Fri, 21 Oct 2022 20:38:51 +0530 Subject: [PATCH 2/5] Create pull_request_template.md Adding a PR template would certainly increase clarity on the PRs and also help us better review changes. This is a starter template. Please feel free to suggest changes, add/remove sections that are not relevant. --- .github/pull_request_template.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..ec22705 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,32 @@ + + +## Description + + +## Motivation and Context + + + +## How Has This Been Tested? + + + + +## Screenshots (if appropriate): + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) +- [ ] Documentation (add or update README or docs) + +## Checklist: + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] I have read the **CONTRIBUTING** document. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. From 14f2d18ea2a8de1085ccf3aedfeb86ef1f4b7bdd Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Wed, 26 Oct 2022 11:15:05 +0000 Subject: [PATCH 3/5] Moved recommendation to skipping steps section --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cbf27b4..4247617 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ If you are using this inside a container, a POSIX-compliant `tar` needs to be in * `cache-hit` - A boolean value to indicate an exact match was found for the key. -> Note: `cache-hit` will be set to `true` only when cache hit occurs for the exact `key` match. For a partial key match via `restore-keys` or a cache miss, it will be set to `false`. It is recommended to install the missing/updated dependencies in case of a partial key match when the key is dependent on the `hash` of the package file. +> Note: `cache-hit` will be set to `true` only when cache hit occurs for the exact `key` match. For a partial key match via `restore-keys` or a cache miss, it will be set to `false`. See [Skipping steps based on cache-hit](#skipping-steps-based-on-cache-hit) for info on using this output @@ -153,7 +153,7 @@ A repository can have up to 10GB of caches. Once the 10GB limit is reached, olde ## Skipping steps based on cache-hit -Using the `cache-hit` output, subsequent steps (such as install or build) can be skipped when a cache hit occurs on the key. +Using the `cache-hit` output, subsequent steps (such as install or build) can be skipped when a cache hit occurs on the key. It is recommended to install the missing/updated dependencies in case of a partial key match when the key is dependent on the `hash` of the package file. Example: ```yaml From d0af8a3eccec64e454f4b48df99baad9a18c7f57 Mon Sep 17 00:00:00 2001 From: Bishal Prasad Date: Mon, 7 Nov 2022 13:22:00 +0530 Subject: [PATCH 4/5] Change datadog/squid to Ubuntu/squid in CI check (#976) --- .github/workflows/workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 320fd46..60410a6 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -99,7 +99,7 @@ jobs: options: --dns 127.0.0.1 services: squid-proxy: - image: datadog/squid:latest + image: ubuntu/squid:latest ports: - 3128:3128 env: @@ -122,7 +122,7 @@ jobs: options: --dns 127.0.0.1 services: squid-proxy: - image: datadog/squid:latest + image: ubuntu/squid:latest ports: - 3128:3128 env: From 9a6a4f6079716b44e70b2e883cfdd6fb7d6ff5d9 Mon Sep 17 00:00:00 2001 From: Bishal Prasad Date: Mon, 7 Nov 2022 15:42:42 +0530 Subject: [PATCH 5/5] Add more details to version section in readme (#971) * Add more details to version section in readme * Update README.md Co-authored-by: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> * Use ubuntu/squid instead of datadog/squid Co-authored-by: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4247617..849941f 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ If you are using this inside a container, a POSIX-compliant `tar` needs to be in See [Skipping steps based on cache-hit](#skipping-steps-based-on-cache-hit) for info on using this output ### Cache scopes -The cache is scoped to the key and branch. The default branch cache is available to other branches. +The cache is scoped to the key, [version](#cache-version) and branch. The default branch cache is available to other branches. See [Matching a cache key](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key) for more info. @@ -175,9 +175,13 @@ steps: ## Cache Version -Cache version is unique for a combination of compression tool used for compression of cache (Gzip, Zstd, etc based on runner OS) and the path of directories being cached. If two caches have different versions, they are identified as unique cache entries. This also means that a cache created on `windows-latest` runner can't be restored on `ubuntu-latest` as cache `Version`s are different. +Cache version is a hash [generated](https://github.com/actions/toolkit/blob/500d0b42fee2552ae9eeb5933091fe2fbf14e72d/packages/cache/src/internal/cacheHttpClient.ts#L73-L90) for a combination of compression tool used (Gzip, Zstd, etc. based on the runner OS) and the `path` of directories being cached. If two caches have different versions, they are identified as unique caches while matching. This for example, means that a cache created on `windows-latest` runner can't be restored on `ubuntu-latest` as cache `Version`s are different. -Example: Below example will create 3 unique caches with same keys. Ubuntu and windows runners will use different compression technique and hence create two different caches. And `build-linux` will create two different caches as the `paths` are different. +> Pro tip: [List caches](https://docs.github.com/en/rest/actions/cache#list-github-actions-caches-for-a-repository) API can be used to get the version of a cache. This can be helpful to troubleshoot cache miss due to version. + +
+ Example +The workflow will create 3 unique caches with same keys. Ubuntu and windows runners will use different compression technique and hence create two different caches. And `build-linux` will create two different caches as the `paths` are different. ```yaml jobs: @@ -224,6 +228,7 @@ jobs: if: steps.cache-primes.outputs.cache-hit != 'true' run: ./generate-primes -d prime-numbers ``` +
## Known practices and workarounds Following are some of the known practices/workarounds which community has used to fulfill specific requirements. You may choose to use them if suits your use case. Note these are not necessarily the only or the recommended solution.