Skip to content

Commit dfe3eac

Browse files
Haroenvshortcuts
andcommitted
ci(circle): use nvm for node unit tests (#1314)
* ci(circle): use nvm for node unit tests * right position * right position * quotes * bash sucks * install nvm * nvm export * rename variables * Update .circleci/config.yml Co-authored-by: Clément Vannicatte <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 8011c0e commit dfe3eac

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

.circleci/config.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ aliases:
2323
defaults: &defaults
2424
working_directory: ~/algoliasearch-client-javascript
2525
parameters:
26-
version:
26+
cimg_version:
2727
type: string
28+
node_version:
29+
type: string
30+
default: ''
2831
docker:
29-
- image: cimg/node:<< parameters.version >>
32+
- image: cimg/node:<< parameters.cimg_version >>
3033

3134
version: 2.1
3235
jobs:
@@ -76,10 +79,19 @@ jobs:
7679
command: yarn test:types
7780

7881
test_unit:
79-
description: Testing code against node << parameters.version >>
82+
description: Testing code against node << parameters.node_version >>
8083
<<: *defaults
8184
steps:
8285
- checkout
86+
- run:
87+
name: Install node version
88+
command: |
89+
if [ '<< parameters.node_version >>' ]; then
90+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash;
91+
export NVM_DIR="$HOME/.nvm";
92+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh";
93+
nvm install '<< parameters.node_version >>';
94+
fi;
8395
- run: *install_yarn_version
8496
- restore_cache: *restore_yarn_cache
8597
- run: *run_yarn_install
@@ -123,19 +135,21 @@ workflows:
123135
ci:
124136
jobs:
125137
- test_unit:
126-
version: '8.17'
138+
# workaround: cimg/node:8 certificate is unsigned, we use nvm instead
139+
cimg_version: '14.17'
140+
node_version: '8.17'
127141
name: 'test_unit_8'
128142
- test_unit:
129-
version: '14.17'
143+
cimg_version: '14.17'
130144
name: 'test_unit_14'
131145
- test_lint:
132-
version: '12.22'
146+
cimg_version: '12.22'
133147
- test_types:
134-
version: '12.22'
148+
cimg_version: '12.22'
135149
- test_build:
136-
version: '12.16.2'
150+
cimg_version: '12.16.2'
137151
- test_browser:
138-
version: '12.16.2'
152+
cimg_version: '12.16.2'
139153
- release:
140154
requires:
141155
- test_unit_8

0 commit comments

Comments
 (0)