Skip to content

Commit 9546401

Browse files
committed
ci: use Node orb and Node 16
1 parent dd66626 commit 9546401

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

.circleci/config.yml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ workflows:
99
- build_for_windows:
1010
context: scratch-desktop-and-link
1111
orbs:
12+
node: circleci/[email protected]
1213
windows: circleci/[email protected]
1314
aliases:
1415
# condition to indicate whether or not we should sign this build
@@ -34,9 +35,11 @@ jobs:
3435
xcode: 11.7.0
3536
resource_class: macos.x86.medium.gen2 # "medium" has been deprecated
3637
steps:
38+
- node/install:
39+
node-version: "16.*"
40+
- run: node --version && npm --version
3741
- checkout
38-
- npm_install:
39-
npmCacheDir: ~/.npm
42+
- node/install-packages
4043
- run:
4144
name: Test
4245
command: npm run test
@@ -101,7 +104,9 @@ jobs:
101104
- store_artifacts:
102105
path: Artifacts/
103106
build_for_windows:
104-
executor: windows/default
107+
executor:
108+
name: windows/default
109+
shell: bash.exe # defaulting to bash at the executor level makes the Node orb kinda work
105110
steps:
106111
- run:
107112
# work around https://github.com/appveyor/ci/issues/2420 which seems to affect CircleCI too
@@ -112,15 +117,26 @@ jobs:
112117
echo 'Adding libexec/git-core to PATH...'
113118
echo 'For more details see https://github.com/appveyor/ci/issues/2420'
114119
echo 'export PATH="$PATH:/c/Program Files/Git/mingw64/libexec/git-core"' >> $BASH_ENV
115-
- run:
116-
# nvm for Windows doesn't accept partial version numbers, so specify exact :(
117-
name: Upgrade to Node 14.17.0
120+
- run: # node/install doesn't work right on Windows
121+
name: Install Node
122+
# as of today, the Windows image comes with nvm 1.1.7
123+
# nvm version 1.1.9 fixes an issue leading to "npm ERR! Unexpected token '.'"
124+
# nvm version 1.1.10 will support "nvm install 16"
125+
# but for now it needs the exact version
118126
command: |
119-
nvm install 14.17.0
120-
nvm use 14.17.0
127+
choco upgrade --yes nvm.portable
128+
nvm --version
129+
nvm install 16.20.0
130+
nvm use 16.20.0
131+
- run:
132+
name: Increase NPM log level to avoid timeouts while installing packages
133+
command: npm config set loglevel http
134+
- run: node --version && npm --version
121135
- checkout
122-
- npm_install:
123-
npmCacheDir: "C:/Users/circleci/AppData/Roaming/npm-cache"
136+
- node/install-packages:
137+
# the Node orb doesn't understand the default cache path on Windows
138+
# make sure to use a path that works with Windows Node.js AND MSYS/MinGW bash
139+
cache-path: "C:/tmp/npm-cache"
124140
- run:
125141
name: Test
126142
command: npm run test
@@ -170,27 +186,6 @@ jobs:
170186
- store_artifacts:
171187
path: Artifacts/
172188
commands:
173-
npm_install:
174-
description: Run 'npm install' with caching
175-
parameters:
176-
npmCacheDir:
177-
type: string
178-
description: NPM cache directory (`npm config cache get`) - usually either ~/.npm or %AppData%/npm-cache
179-
steps:
180-
- restore_cache:
181-
keys:
182-
- npm-cache-{{ arch }}-{{ checksum "package-lock.json" }}
183-
- run:
184-
name: Install node_modules
185-
shell: bash # harmless on macOS, required on Windows to work around git-sh-setup issue
186-
# --prefer-offline "will make npm skip any conditional requests (304 checks) for stale cache data, and only
187-
# hit the network if something is missing from the cache"
188-
command: npm ci --prefer-offline
189-
environment: *clear_context
190-
- save_cache:
191-
paths:
192-
- << parameters.npmCacheDir >>
193-
key: npm-cache-{{ arch }}-{{ checksum "package-lock.json" }}
194189
build:
195190
steps:
196191
- when:

0 commit comments

Comments
 (0)