Intent
Currently it takes ~6 minutes for the yarn install step in the Smoke Tests to run. The goal was to leverage caching to speed this up.
The Result:
Best case scenario, if all dirs have cache hits, this step now takes ~45 seconds.
Before

After

Approach
- Before installing dependencies, we first attempt to restore the cache for key directories. (I used this file to identify where the install commands originated so I could target them effectively.)
- Yarn then installs the dependencies — this process should be faster if the cache was successfully restored.
- Finally, we save the cache if it doesn't already exist.
ℹ️ FYI: There is a cleaner cache action that combines both restore and save steps. However, the "always save" feature doesn't (and likely won't ever) work as intended: actions/cache#1315. We need it to always save because if the tests fail, the job won't save new caches since it's a post-cleanup step.
QA Notes
Both Pull Requests (PRs) and merges to main use the same GitHub workflow to run tests. You can review the performance and results of this run in the PR, which will impact both.
Also, it's important to note about GitHub caching:
Caches are scoped to a key and a branch, so a cache created on branch-A won’t be accessible from branch-B unless branch-A is the default branch.
It’s recommended to have a workflow run on your default branch (e.g., main) so that workflows on other branches can restore caches from it.