Skip to content

Commit bc0f8e2

Browse files
Update test-cache-restore.yml
1 parent c337540 commit bc0f8e2

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,35 @@ on:
66
jobs:
77
build:
88
runs-on: ${{ matrix.os }}
9+
910
strategy:
1011
matrix:
1112
os: [ubuntu-latest, macos-latest, windows-latest]
1213

1314
steps:
1415
- uses: actions/checkout@v6
15-
16-
# Setup Node.js only (no cache here – handled manually)
1716
- name: Setup Node.js
18-
id: setup-node
1917
uses: actions/setup-node@v6
2018
with:
2119
node-version: '21'
2220

23-
# Ensure pnpm is available if pnpm-lock.yaml exists
2421
- name: Setup pnpm
25-
if: hashFiles('**/pnpm-lock.yaml') != ''
22+
if: hashFiles('pnpm-lock.yaml') != ''
2623
uses: pnpm/action-setup@v4
2724
with:
2825
version: 10
26+
run_install: false
2927

30-
# Normalize runner.arch (x64 / arm64)
3128
- name: Normalize runner architecture
3229
shell: bash
3330
run: |
3431
echo "ARCH=$(echo '${{ runner.arch }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
3532
36-
# Detect package manager + cache path
3733
- name: Detect package manager and cache path
3834
shell: bash
3935
run: |
4036
set -e
37+
4138
if [ -f pnpm-lock.yaml ]; then
4239
PM=pnpm
4340
CACHE_PATH=$(pnpm store path)
@@ -51,38 +48,40 @@ jobs:
5148
CACHE_PATH=$(npm config get cache)
5249
LOCK_PATTERN="**/package-lock.json"
5350
fi
51+
5452
echo "PACKAGE_MANAGER=$PM" >> $GITHUB_ENV
5553
echo "NODE_CACHE=$CACHE_PATH" >> $GITHUB_ENV
5654
echo "LOCK_PATTERN=$LOCK_PATTERN" >> $GITHUB_ENV
57-
5855
- name: Debug cache variables
56+
shell: bash
5957
run: |
6058
echo "OS=${{ runner.os }}"
6159
echo "ARCH=$ARCH"
6260
echo "PACKAGE_MANAGER=$PACKAGE_MANAGER"
6361
echo "NODE_CACHE=$NODE_CACHE"
6462
echo "LOCK_PATTERN=$LOCK_PATTERN"
6563
66-
# Restore Node cache
6764
- name: Restore Node cache
68-
id: node-cache
6965
uses: actions/cache/restore@v5
7066
with:
7167
path: ${{ env.NODE_CACHE }}
7268
key: node-cache-${{ runner.os }}-${{ env.ARCH }}-${{ env.PACKAGE_MANAGER }}-${{ hashFiles(env.LOCK_PATTERN) }}
7369

74-
# Install dependencies (PM-aware)
7570
- name: Install dependencies
7671
shell: bash
7772
run: |
7873
if [ "$PACKAGE_MANAGER" = "pnpm" ]; then
79-
pnpm install --frozen-lockfile
74+
if pnpm install --frozen-lockfile; then
75+
echo "pnpm frozen-lockfile install succeeded"
76+
else
77+
echo "pnpm lockfile incompatible — retrying without frozen-lockfile"
78+
pnpm install --no-frozen-lockfile
79+
fi
8080
elif [ "$PACKAGE_MANAGER" = "yarn" ]; then
8181
yarn install --frozen-lockfile
8282
else
8383
npm ci
8484
fi
85-
8685
- name: Build
8786
shell: bash
8887
run: |

0 commit comments

Comments
 (0)