Skip to content

Commit 2846bf0

Browse files
chore: update GH workflows to use pnpm
1 parent 5d7b85d commit 2846bf0

File tree

5 files changed

+67
-55
lines changed

5 files changed

+67
-55
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ jobs:
159159
uses: actions/setup-node@v4
160160
with:
161161
node-version: ${{ matrix.node-release-override || matrix.node }}
162+
cache: "pnpm"
162163

163164
# On Windows, the 'runner.temp' variable uses backslashes as path separators, but
164165
# that may pose problems in later steps when we try to join that with subpaths;
@@ -172,25 +173,25 @@ jobs:
172173
run: echo "dir=$(pwd)" >> ${GITHUB_OUTPUT}
173174
working-directory: ${{ runner.temp }}
174175

175-
- name: Get NPM cache directory
176-
id: npm-cache-dir
177-
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
176+
- name: Get PNPM store directory
177+
id: pnpm-cache-dir
178+
run: echo "dir=$(pnpm store path)" >> ${GITHUB_OUTPUT}
178179

179-
- name: Restore NPM cache
180+
- name: Restore PNPM cache
180181
uses: actions/cache/restore@v4
181182
with:
182-
path: ${{ steps.npm-cache-dir.outputs.dir }}
183-
key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}
183+
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
184+
key: pnpm-main-${{ matrix.platform }}-${{ hashFiles('./pnpm-lock.yaml') }}
184185
restore-keys: |
185-
npm-main-${{ matrix.platform }}-
186+
pnpm-main-${{ matrix.platform }}-
186187
187188
- name: Download dependencies
188189
# Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors :(
189190
run: |
190-
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
191+
pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile
191192
192193
- name: Compile code
193-
run: npm run build -- --ignore @temporalio/core-bridge
194+
run: pnpm run build -- --ignore @temporalio/core-bridge
194195

195196
- name: Publish to Verdaccio
196197
run: node scripts/publish-to-verdaccio.js --registry-dir ${{ steps.tmp-dir.outputs.dir }}/npm-registry
@@ -208,7 +209,7 @@ jobs:
208209
--headless &> ./devserver.log &
209210
210211
- name: Run Tests
211-
run: npm run test
212+
run: pnpm run test
212213
env:
213214
RUN_INTEGRATION_TESTS: true
214215
REUSE_V8_CONTEXT: ${{ matrix.reuse-v8-context }}
@@ -272,6 +273,7 @@ jobs:
272273
273274
# End samples
274275

276+
# TODO: PNPM doesn't write logs to file by default
275277
- name: Upload NPM logs
276278
uses: actions/upload-artifact@v4
277279
if: failure() || cancelled()

.github/workflows/conventions.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ jobs:
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: 22
23+
cache: "pnpm"
2324

2425
- name: Get NPM cache directory
25-
id: npm-cache-dir
26+
id: pnpm-cache-dir
2627
shell: bash
27-
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
28+
run: echo "dir=$(pnpm store path)" >> ${GITHUB_OUTPUT}
2829

2930
- name: Restore NPM cache
3031
uses: actions/cache/restore@v4
3132
with:
32-
path: ${{ steps.npm-cache-dir.outputs.dir }}
33-
key: npm-main-linux-x64-${{ hashFiles('./package-lock.json') }}
33+
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
34+
key: pnpm-main-linux-x64-${{ hashFiles('./pnpm-lock.yaml') }}
3435
restore-keys: |
35-
npm-main-linux-x64-
36+
pnpm-main-linux-x64-
3637
3738
- name: Install protoc
3839
uses: arduino/setup-protoc@v3
@@ -56,11 +57,11 @@ jobs:
5657

5758
- name: Download dependencies
5859
run: |
59-
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
60+
pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile
6061
6162
# eslint-import-resolver-typescript requires packages to be built
6263
- name: Compile all non-rust code
63-
run: npm run build -- --ignore @temporalio/core-bridge
64+
run: pnpm run build -- --ignore @temporalio/core-bridge
6465

65-
- run: npm run lint.check
66-
- run: npm run lint.prune
66+
- run: pnpm run lint.check
67+
- run: pnpm run lint.prune

.github/workflows/docs.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,38 @@ jobs:
3535
with:
3636
submodules: recursive
3737

38+
- name: Install pnpm
39+
uses: pnpm/action-setup@v4
40+
with:
41+
version: 10
42+
run_install: false
43+
3844
- name: Install Node
3945
uses: actions/setup-node@v4
4046
with:
4147
node-version: 22
48+
cache: "pnpm"
4249

43-
- name: Get NPM cache directory
44-
id: npm-cache-dir
50+
- name: Get PNPM cache directory
51+
id: pnpm-cache-dir
4552
shell: bash
46-
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
53+
run: echo "dir=$(pnpm store path)" >> ${GITHUB_OUTPUT}
4754

4855
- name: Restore NPM cache
4956
uses: actions/cache/restore@v4
5057
with:
51-
path: ${{ steps.npm-cache-dir.outputs.dir }}
52-
key: npm-main-linux-x64-${{ hashFiles('./package-lock.json') }}
58+
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
59+
key: pnpm-main-linux-x64-${{ hashFiles('./pnpm-lock.yaml') }}
5360
restore-keys: |
54-
npm-main-linux-x64-
61+
pnpm-main-linux-x64-
5562
5663
- name: Download dependencies
5764
# Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors
5865
# Don't build during install phase since we're going to explicitly build anyway
5966
run: |
60-
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
67+
pnpm install --frozen-lockfile --ignore-scripts || pnpm install --frozen-lockfile --ignore-scripts || pnpm install --frozen-lockfile --ignore-scripts
6168
62-
- run: npm run build -- --ignore @temporalio/core-bridge
69+
- run: pnpm run build -- --ignore @temporalio/core-bridge
6370

6471
- name: Build docs
6572
run: npm run docs

.github/workflows/release.yml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -169,26 +169,27 @@ jobs:
169169
uses: actions/setup-node@v4
170170
with:
171171
node-version: 22
172+
cache: "pnpm"
172173

173-
- name: Get NPM cache directory
174-
id: npm-cache-dir
175-
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
174+
- name: Get PNPM cache directory
175+
id: pnpm-cache-dir
176+
run: echo "dir=$(pnpm store path)" >> ${GITHUB_OUTPUT}
176177

177-
- name: Restore NPM cache
178+
- name: Restore PNPM cache
178179
uses: actions/cache/restore@v4
179180
with:
180-
path: ${{ steps.npm-cache-dir.outputs.dir }}
181-
key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}
181+
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
182+
key: pnpm-main-${{ matrix.platform }}-${{ hashFiles('./pnpm-lock.yaml') }}
182183
restore-keys: |
183-
npm-main-${{ matrix.platform }}-
184+
pnpm-main-${{ matrix.platform }}-
184185
185186
- name: Download dependencies
186187
# Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors :(
187188
run: |
188-
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
189+
pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile
189190
190191
- name: Compile code
191-
run: npm run build -- --ignore @temporalio/core-bridge
192+
run: pnpm run build -- --ignore @temporalio/core-bridge
192193

193194
- name: Publish to Verdaccio
194195
run: node scripts/publish-to-verdaccio.js --registry-dir ./tmp/registry
@@ -199,13 +200,13 @@ jobs:
199200
name: verdaccio-repo
200201
path: ./tmp/registry/storage
201202

202-
- name: Save NPM cache
203+
- name: Save PNPM cache
203204
uses: actions/cache/save@v4
204205
# Only saves NPM cache from the main branch, to reduce pressure on the cache (limited to 10GB).
205206
if: ${{ env.IS_MAIN_OR_RELEASE == 'true' }}
206207
with:
207-
path: ${{ steps.npm-cache-dir.outputs.dir }}
208-
key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}
208+
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
209+
key: pnpm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}
209210

210211
# Tests that npm init @temporalio results in a working worker and client
211212
test-npm-init:
@@ -259,23 +260,23 @@ jobs:
259260
with:
260261
node-version: ${{ matrix.node }}
261262

262-
- name: Get NPM cache directory
263-
id: npm-cache-dir
263+
- name: Get PNPM cache directory
264+
id: pnpm-cache-dir
264265
shell: bash
265-
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
266+
run: echo "dir=$(pnpm store path)" >> ${GITHUB_OUTPUT}
266267

267268
- name: Restore NPM cache
268269
uses: actions/cache/restore@v4
269270
with:
270-
path: ${{ steps.npm-cache-dir.outputs.dir }}
271-
key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}
271+
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
272+
key: pnpm-main-${{ matrix.platform }}-${{ hashFiles('./pnpm-lock.yaml') }}
272273
restore-keys: |
273-
npm-main-${{ matrix.platform }}-
274+
pnpm-main-${{ matrix.platform }}-
274275
275276
# No need to compile anything, we just need the package ./scripts and their dependencies
276277
- name: Install dependencies without compilation
277278
run: |
278-
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
279+
pnpm install ---frozen-lockfile || pnpm install ---frozen-lockfile || pnpm install ---frozen-lockfile
279280
280281
- name: Restore Verdaccio repo artifact
281282
uses: actions/download-artifact@v4

.github/workflows/stress.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,19 @@ jobs:
6363
uses: actions/setup-node@v4
6464
with:
6565
node-version: 22
66+
cache: "pnpm"
6667

67-
- name: Get NPM cache directory
68-
id: npm-cache-dir
69-
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
68+
- name: Get PNPM cache directory
69+
id: pnpm-cache-dir
70+
run: echo "dir=$(pnpm store path)" >> ${GITHUB_OUTPUT}
7071

71-
- name: Restore NPM cache
72+
- name: Restore PNPM cache
7273
uses: actions/cache/restore@v4
7374
with:
74-
path: ${{ steps.npm-cache-dir.outputs.dir }}
75-
key: npm-main-linux-x64-${{ hashFiles('./package-lock.json') }}
75+
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
76+
key: pnpm-main-linux-x64-${{ hashFiles('./pnpm-lock.yaml') }}
7677
restore-keys: |
77-
npm-main-linux-x64-
78+
pnpm-main-linux-x64-
7879
7980
- name: Install protoc
8081
uses: arduino/setup-protoc@v3
@@ -98,10 +99,10 @@ jobs:
9899
- name: Download dependencies
99100
# Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors
100101
run: |
101-
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
102+
pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile
102103
103104
- name: Compile code
104-
run: npm run build
105+
run: pnpm run build
105106
env:
106107
BUILD_CORE_RELEASE: true
107108

0 commit comments

Comments
 (0)