-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: composite action for caching, remove fallback restore keys (#4709
) This update refactors the caching steps in the merge-to-main and full-test-suite workflows by consolidating them into a GitHub composite action. This change enhances maintainability by reducing code duplication. Additionally, fallback restore keys have been removed, ensuring that cache restoration will only occur when an exact match to the lock file is found, improving cache reliability and avoiding stale dependencies. Update: In this PR, after I moved the restore/save cache logic into composite actions, I noticed the cache was being restored correctly. However, the cache hit always returned false. It seems the downstream job doesn’t have access to the output from the step when it’s part of a composite action, which is disappointing. Instead of keeping the the save/restore process split, I reverted to using the default cache action (which combines it into one) and saves the cache as a post step when everything completes. The drawback is that if there’s a failure (such as a test error), the save cache step won’t execute. --------- Signed-off-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> Co-authored-by: Jon Vanausdeln <jonv@live.com> Co-authored-by: sharon <sharon-wang@users.noreply.github.com> Co-authored-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> Co-authored-by: Wasim Lorgat <mwlorgat@gmail.com> Co-authored-by: Jonathan <jonathan@rstudio.com> Co-authored-by: positron-bot[bot] <173392469+positron-bot[bot]@users.noreply.github.com> Co-authored-by: Christopher Mead <chrisrmead@comcast.net>
- Loading branch information
1 parent
f4c3d4e
commit 6f0875d
Showing
3 changed files
with
43 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: "Cache Multiple Directories" | ||
description: "Restores/Saves cache for node_modules, build, extensions, and remote" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Cache node_modules | ||
id: cache-node-modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./node_modules | ||
key: root-node-modules-v6-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | ||
|
||
- name: Cache build | ||
id: cache-build | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./build/node_modules | ||
key: build-node-modules-v6-${{ runner.os }}-${{ hashFiles('build/yarn.lock') }} | ||
|
||
- name: Cache extensions | ||
id: cache-extensions | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
./extensions | ||
./extensions/**/node_modules | ||
key: extensions-v6-${{ runner.os }}-${{ hashFiles('extensions/yarn.lock') }} | ||
|
||
- name: Cache remote | ||
id: cache-remote | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
./remote/node_modules | ||
./remote/**/node_modules | ||
key: remote-node-modules-v6-${{ runner.os }}-${{ hashFiles('remote/yarn.lock') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters