Use a separate GHA cache for each matrix build (#1605)
You can't update a GHA cache once you create it, so if we use the same cache for each job in a matrix build, then we end up populating it for the first job that completes, so any slower jobs don't get their dependencies cached. On the other hand, if we create 20 500MB cache items on each build, we're going to exhaust the cache storage as soon as we do a build. So, instead, let's just do the caching for the main branch, and hope that other branches can still benefit from it.
This commit is contained in:
committed by
GitHub
parent
a86754a317
commit
a2da63758c
@@ -51,6 +51,14 @@ jobs:
|
||||
|
||||
- name: Load cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# use a separate cache for each job to work around
|
||||
# https://github.com/Swatinem/rust-cache/issues/124
|
||||
key: "${{ matrix.name }}"
|
||||
|
||||
# ... but only save the cache on the main branch
|
||||
# cf https://github.com/Swatinem/rust-cache/issues/95
|
||||
save-if: ${{ github.ref == 'refs/head/main' }}
|
||||
|
||||
- name: Install nextest
|
||||
uses: taiki-e/install-action@nextest
|
||||
@@ -239,6 +247,14 @@ jobs:
|
||||
|
||||
- name: Load cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# use a separate cache for each job to work around
|
||||
# https://github.com/Swatinem/rust-cache/issues/124
|
||||
key: "${{ matrix.cmd }}"
|
||||
|
||||
# ... but only save the cache on the main branch
|
||||
# cf https://github.com/Swatinem/rust-cache/issues/95
|
||||
save-if: ${{ github.ref == 'refs/head/main' }}
|
||||
|
||||
- name: Install nextest
|
||||
uses: taiki-e/install-action@nextest
|
||||
|
||||
Reference in New Issue
Block a user