-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Streamline some caching (#13355)
This streamlines some caching stuff for CI: 1. Extract dependency installation & cache out into a composite action for reusability 2. Updated the cache key for dependencies to only include package & dev-package `package.json`, not the E2E test ones.
- Loading branch information
Showing
2 changed files
with
36 additions
and
33 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,29 @@ | ||
name: "Install yarn dependencies" | ||
description: "Installs yarn dependencies and caches them." | ||
|
||
outputs: | ||
cache_key: | ||
description: "The dependency cache key" | ||
value: ${{ steps.compute_lockfile_hash.outputs.hash }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# we use a hash of yarn.lock as our cache key, because if it hasn't changed, our dependencies haven't changed, | ||
# so no need to reinstall them | ||
- name: Compute dependency cache key | ||
id: compute_lockfile_hash | ||
run: echo "hash=dependencies-${{ hashFiles('yarn.lock', 'packages/*/package.json', 'dev-packages/*/package.json') }}" >> "$GITHUB_OUTPUT" | ||
shell: bash | ||
|
||
- name: Check dependency cache | ||
uses: actions/cache@v4 | ||
id: cache_dependencies | ||
with: | ||
path: ${{ env.CACHED_DEPENDENCY_PATHS }} | ||
key: ${{ steps.compute_lockfile_hash.outputs.hash }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache_dependencies.outputs.cache-hit != 'true' | ||
run: yarn install --ignore-engines --frozen-lockfile | ||
shell: bash |
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