Skip to content

Commit 17bde3e

Browse files
Update test-cache-restore.yml
1 parent e9e2f43 commit 17bde3e

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

.github/workflows/test-cache-restore.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,54 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v6
1515

16+
# Setup Node.js and install pnpm
1617
- name: Setup Node.js
1718
id: setup-node
1819
uses: actions/setup-node@v6
1920
with:
2021
node-version: '21'
21-
package-manager-cache: true # IMPORTANT
2222

23-
# Normalize arch
23+
# Install pnpm globally
24+
- name: Install pnpm
25+
run: npm install -g pnpm
26+
27+
# Normalize runner architecture
2428
- name: Normalize runner architecture
2529
shell: bash
2630
run: |
2731
echo "ARCH=$(echo '${{ runner.arch }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
28-
# Node equivalent of `go env GOMODCACHE`
29-
- name: Set Node cache path
32+
33+
# Set pnpm cache path
34+
- name: Set pnpm cache path
3035
if: runner.os != 'Windows'
3136
shell: bash
3237
run: |
33-
set -e
34-
echo "NODE_CACHE=$(npm config get cache)" >> $GITHUB_ENV
35-
- name: Set Node cache path (Windows)
38+
echo "NODE_CACHE=$(pnpm store path)" >> $GITHUB_ENV
39+
40+
- name: Set pnpm cache path (Windows)
3641
if: runner.os == 'Windows'
3742
shell: pwsh
3843
run: |
39-
"NODE_CACHE=$(npm config get cache)" | Out-File $env:GITHUB_ENV -Append
44+
$cache = pnpm store path
45+
echo "NODE_CACHE=$cache" | Out-File $env:GITHUB_ENV -Append
46+
47+
# Debug cache env
4048
- name: Debug cache env
4149
run: |
4250
echo "ARCH=$ARCH"
4351
echo "NODE_CACHE=$NODE_CACHE"
44-
- name: Restore Node cache
52+
53+
# Restore pnpm cache
54+
- name: Restore pnpm cache
4555
uses: actions/cache/restore@v5
4656
with:
4757
path: ${{ env.NODE_CACHE }}
48-
key: node-cache-${{ runner.os }}-${{ env.ARCH }}-pnpm-${{ hashFiles('**/package-lock.json', '**/npm-shrinkwrap.json') }}
58+
key: node-cache-${{ runner.os }}-${{ env.ARCH }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
4959

60+
# Install dependencies
5061
- name: Install dependencies
51-
run: npm ci
62+
run: pnpm install
5263

64+
# Build
5365
- name: Build
54-
run: npm run build --if-present
66+
run: pnpm run build --if-present

0 commit comments

Comments
 (0)