From 75b110bc854cb272b33517e4c2b7dfb7e3eac2d1 Mon Sep 17 00:00:00 2001 From: Malte Brunnlieb Date: Fri, 27 Jan 2023 06:35:14 +0100 Subject: [PATCH 1/2] Added another hint to foresee #1072 --- tips-and-workarounds.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tips-and-workarounds.md b/tips-and-workarounds.md index 3a63d24..240e167 100644 --- a/tips-and-workarounds.md +++ b/tips-and-workarounds.md @@ -22,7 +22,8 @@ Reusing cache across feature branches is not allowed today to provide cache [iso ## Cross OS cache From `v3.2.3` cache is cross-os compatible when `enableCrossOsArchive` input is passed as true. This means that a cache created on `ubuntu-latest` or `mac-latest` can be used by `windows-latest` and vice versa, provided the workflow which runs on `windows-latest` have input `enableCrossOsArchive` as true. This is useful to cache dependencies which are independent of the runner platform. This will help reduce the consumption of the cache quota and help build for multiple platforms from the same cache. Things to keep in mind while using this feature: - Only cache those files which are compatible across OSs. -- Caching symlinks might cause issues while restoration as they work differently on different OSs. +- Caching symlinks might cause issues while restoration as they work differently on different OSs. +- Only cache files, which are within your github workspace directory. Don't try to use directory pointer like `${{ github.workspace }}` or `~` (home) eventually being evaluated to an absolute path, as the paths will not match the setup across OSs. ## Force deletion of caches overriding default cache eviction policy Caches have [branch scope restriction](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache) in place. This means that if caches for a specific branch are using a lot of storage quota, it may result into more frequently used caches from `default` branch getting thrashed. For example, if there are many pull requests happening on a repo and are creating caches, these cannot be used in default branch scope but will still occupy a lot of space till they get cleaned up by [eviction policy](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy). But sometime we want to clean them up on a faster cadence so as to ensure default branch is not thrashing. In order to achieve this, [gh-actions-cache cli](https://github.com/actions/gh-actions-cache/) can be used to delete caches for specific branches. @@ -67,4 +68,4 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` - \ No newline at end of file + From 1b004e8a69df75001db3876453d75c84376e630e Mon Sep 17 00:00:00 2001 From: Malte Brunnlieb Date: Fri, 27 Jan 2023 09:07:57 +0100 Subject: [PATCH 2/2] Update tips-and-workarounds.md Co-authored-by: Lovepreet Singh --- tips-and-workarounds.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tips-and-workarounds.md b/tips-and-workarounds.md index 240e167..0cf05a4 100644 --- a/tips-and-workarounds.md +++ b/tips-and-workarounds.md @@ -23,7 +23,8 @@ Reusing cache across feature branches is not allowed today to provide cache [iso From `v3.2.3` cache is cross-os compatible when `enableCrossOsArchive` input is passed as true. This means that a cache created on `ubuntu-latest` or `mac-latest` can be used by `windows-latest` and vice versa, provided the workflow which runs on `windows-latest` have input `enableCrossOsArchive` as true. This is useful to cache dependencies which are independent of the runner platform. This will help reduce the consumption of the cache quota and help build for multiple platforms from the same cache. Things to keep in mind while using this feature: - Only cache those files which are compatible across OSs. - Caching symlinks might cause issues while restoration as they work differently on different OSs. -- Only cache files, which are within your github workspace directory. Don't try to use directory pointer like `${{ github.workspace }}` or `~` (home) eventually being evaluated to an absolute path, as the paths will not match the setup across OSs. +- Only cache files from within your github workspace directory. +- Avoid using directory pointers such as `${{ github.workspace }}` or `~` (home) which eventually evaluate to an absolute path and will not match across OSs. ## Force deletion of caches overriding default cache eviction policy Caches have [branch scope restriction](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache) in place. This means that if caches for a specific branch are using a lot of storage quota, it may result into more frequently used caches from `default` branch getting thrashed. For example, if there are many pull requests happening on a repo and are creating caches, these cannot be used in default branch scope but will still occupy a lot of space till they get cleaned up by [eviction policy](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy). But sometime we want to clean them up on a faster cadence so as to ensure default branch is not thrashing. In order to achieve this, [gh-actions-cache cli](https://github.com/actions/gh-actions-cache/) can be used to delete caches for specific branches.