-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: match cache restore-keys
in creation reverse order
#2153
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2153 +/- ##
==========================================
- Coverage 61.22% 60.78% -0.45%
==========================================
Files 46 53 +7
Lines 7141 8970 +1829
==========================================
+ Hits 4372 5452 +1080
- Misses 2462 3080 +618
- Partials 307 438 +131 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can confirm that this works and the old implementation was incorrect, both can be checked by running this workflow file: It only succeeds after applying this PR after the fix from today
on: push
defaults:
run:
shell: bash
jobs:
createcache:
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v3
id: cache
with:
path: |
./.cache
key: prefix0-keya
- run: |
mkdir ./.cache
echo createcache > ./.cache/Test
if: steps.cache.outputs.cache-hit != 'true'
- run: exit 1
if: steps.cache.outputs.cache-hit == 'true'
createcache2:
runs-on: ubuntu-latest
needs: createcache
steps:
- uses: actions/cache@v3
id: cache
with:
path: |
./.cache
key: prefix0-keyb
- run: |
mkdir ./.cache
echo createcache2 > ./.cache/Test
if: steps.cache.outputs.cache-hit != 'true'
- run: exit 1
if: steps.cache.outputs.cache-hit == 'true'
createcache3:
runs-on: ubuntu-latest
needs: createcache2
steps:
- uses: actions/cache@v3
id: cache
with:
path: |
./.cache
key: prefix1-keya
- run: |
mkdir ./.cache
echo createcache3 > ./.cache/Test
if: steps.cache.outputs.cache-hit != 'true'
- run: exit 1
if: steps.cache.outputs.cache-hit == 'true'
hitcache:
needs: createcache3
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v3
id: cache
with:
path: |
./.cache
key: dummy-key
restore-keys: |
prefix0-
- run: 'ls -l ./.cache'
- run: exit 1
if: steps.cache.outputs.cache-hit == 'true'
- run: echo We got the expected non exact hit the cache!
if: steps.cache.outputs.cache-hit != 'true'
- run: |
cat ./.cache/Test
- name: Verify that the right entry has been restored
run: |
[[ "createcache2" != "$(cat ./.cache/Test )" ]] && exit 1 || exit 0
@Mergifyio refresh |
✅ Pull request refreshed |
@fuufen this pull request has failed checks 🛠 |
* Match cache restore-keys in creation reverse order * Match full prefix when selecting cache --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fixes #1823
Will now return from cache in the order mentioned in GitHub Actions cache docs: