-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5567 from NomicFoundation/galargh/github-actions-…
…caching-v2 ci(v2): improve usage of github actions cache
- Loading branch information
Showing
29 changed files
with
152 additions
and
392 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,43 @@ | ||
name: Setup env | ||
description: Sets up node and pnpm | ||
|
||
inputs: | ||
pnpm-version: | ||
description: Version of pnpm to install | ||
required: false | ||
default: "9" | ||
node-version: | ||
description: Version of node to install | ||
required: false | ||
default: "18" | ||
cache-save: | ||
description: Whether to save the pnpm cache | ||
required: false | ||
default: "false" | ||
outputs: | ||
cache-hit: | ||
description: Whether the cache was restored | ||
value: ${{ steps.setup-node.outputs.cache-hit || steps.cache-restore.outputs.cache-hit }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: ${{ inputs.pnpm-version }} | ||
- uses: actions/setup-node@v4 | ||
id: setup-node | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
cache: ${{ inputs.cache-save == 'true' && 'pnpm' || '' }} | ||
cache-dependency-path: "**/pnpm-lock.yaml" | ||
- id: pnpm | ||
if: inputs.cache-save == 'false' | ||
run: pnpm store path --silent | xargs -I {} -0 echo "path={}" | tee -a $GITHUB_OUTPUT | ||
shell: bash | ||
- uses: actions/cache/restore@v4 | ||
id: cache-restore | ||
if: inputs.cache-save == 'false' | ||
with: | ||
path: ${{ steps.pnpm.outputs.path }} | ||
key: node-cache-${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Cache | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- pre-release-testing-branch | ||
- changeset-release/main | ||
- v-next | ||
paths: | ||
- ".github/workflows/cache.yml" | ||
- "**/pnpm-lock.yaml" | ||
pull_request: | ||
paths: | ||
- ".github/workflows/cache.yml" | ||
- "**/pnpm-lock.yaml" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{github.workflow}}-${{github.ref}} | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
cache: | ||
name: Cache | ||
runs-on: ${{ matrix.runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runner: ["ubuntu-latest", "macos-latest", "windows-latest"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: env | ||
uses: ./.github/actions/setup-env | ||
with: | ||
cache-save: true | ||
- name: Install | ||
if: steps.env.outputs.cache-hit != 'true' | ||
run: | | ||
for lockfile in $(find "$(pwd)" -name pnpm-lock.yaml); do | ||
pushd "$(dirname "$lockfile")" | ||
pnpm install --frozen-lockfile --prefer-offline | ||
popd | ||
done |
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
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
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
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
Oops, something went wrong.