Skip to content
This repository was archived by the owner on Apr 21, 2022. It is now read-only.

Commit ea4bae7

Browse files
authored
build: use circleci orb to install node/yarn (#329)
* build: use circleci orb to install node/yarn This will help the build not break when we need a later version of node that is within range. * build: use yarn --prefer-offline to speed up installs a tiny amount * build: pass .yarn as cache-path to circleci node orb
1 parent 9856c8a commit ea4bae7

2 files changed

Lines changed: 57 additions & 24 deletions

File tree

.circleci/config.yml

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,44 @@
11
---
2-
version: 2
2+
version: 2.1
3+
orbs:
4+
node: circleci/node@4.2.0
35
jobs:
4-
node-12: &test
6+
test-node: &test
7+
parameters:
8+
node-version:
9+
type: string
10+
description: "node.js version to install"
511
docker:
612
- image: oclif/nsis:12.0.0-16
713
working_directory: ~/cli
814
environment:
915
NYC: "yarn exec nyc -- --nycrc-path node_modules/@oclif/nyc-config/.nycrc"
1016
steps:
1117
- checkout
12-
- restore_cache: &restore_cache
13-
keys:
14-
- v6-yarn-{{checksum ".circleci/config.yml"}}-{{ checksum "yarn.lock"}}
15-
- v6-yarn-{{checksum ".circleci/config.yml"}}
18+
- run: &setup_yarn
19+
name: Setup Yarn
20+
command: |
21+
mkdir -p .yarn
22+
echo "--install.cache-path $(pwd)/.yarn/cache" >> .yarnrc
23+
echo "--install.prefer-offline" >> .yarnrc
24+
echo "yarn-offline-mirror $(pwd)/.yarn/offline-mirror" >> .yarnrc
25+
- node/install: &install_node
26+
install-yarn: true
27+
node-version: << parameters.node-version >>
28+
- run: &create_cache_key_file
29+
name: "Create Cache Key File"
30+
command: |
31+
echo "node: $(node --version)" >> .circleci-cache-key
32+
echo "yarn: $(yarn --version)" >> .circleci-cache-key
33+
echo "yarnrc: $(sha256sum .yarnrc)" >> .circleci-cache-key
34+
echo ".circleci/config.yml: $(sha256sum .circleci/config.yml)" >> .circleci-cache-key
35+
- node/install-packages: &install_node_packages
36+
cache-path: ".yarn"
37+
cache-version: &cache_key |
38+
{{checksum ".circleci-cache-key"}}
39+
pkg-manager: yarn
40+
include-branch-in-cache-key: false
1641
- run: 'echo "Node: `node --version`"'
17-
- run: yarn
1842
- run: .circleci/loadgpg
1943
- run: yarn add -D nyc@13 @oclif/nyc-config@1
2044
- run: ./node_modules/.bin/tsc
@@ -23,17 +47,16 @@ jobs:
2347
- run: |
2448
$NYC yarn test
2549
curl -s https://codecov.io/bash | bash
26-
node-10:
27-
<<: *test
28-
docker:
29-
- image: chadian/nsis:10-2
3050
release:
3151
<<: *test
3252
steps:
3353
- add_ssh_keys
3454
- checkout
55+
- run: *setup_yarn
56+
- node/install: *install_node
57+
- run: *create_cache_key_file
58+
- node/install-packages: *install_node_packages
3559
- run: .circleci/loadgpg
36-
- restore_cache: *restore_cache
3760
- run: yarn global add @oclif/semantic-release@3 semantic-release@17
3861
- run: yarn --frozen-lockfile
3962
- run: ./bin/run pack
@@ -55,15 +78,20 @@ jobs:
5578
- /usr/local/share/.config/yarn
5679

5780
workflows:
58-
version: 2
59-
"@oclif/dev-cli":
81+
version: 2.1
82+
build:
6083
jobs:
61-
- node-12
62-
- node-10
84+
- test-node:
85+
matrix:
86+
parameters:
87+
node-version:
88+
- "10"
89+
- "12"
90+
- "14"
6391
- release:
92+
node-version: "14"
6493
context: org-global
6594
filters:
6695
branches: {only: master}
6796
requires:
68-
- node-12
69-
- node-10
97+
- test-node

yarn.lock

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,16 @@
255255
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6"
256256
integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=
257257

258-
"@types/mocha@*", "@types/mocha@^8.0.0":
258+
"@types/mocha@*":
259259
version "8.2.1"
260260
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.2.1.tgz#f3f3ae4590c5386fc7c543aae9b78d4cf30ffee9"
261261
integrity sha512-NysN+bNqj6E0Hv4CTGWSlPzMW6vTKjDpOteycDkV4IWBsO+PU48JonrPzV9ODjiI2XrjmA05KInLgF5ivZ/YGQ==
262262

263+
"@types/mocha@^7.0.2":
264+
version "7.0.2"
265+
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-7.0.2.tgz#b17f16cf933597e10d6d78eae3251e692ce8b0ce"
266+
integrity sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==
267+
263268
"@types/nock@*":
264269
version "10.0.3"
265270
resolved "https://registry.yarnpkg.com/@types/nock/-/nock-10.0.3.tgz#dab1d18ffbccfbf2db811dab9584304eeb6e1c4c"
@@ -282,10 +287,10 @@
282287
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-7.0.12.tgz#18412939ae45b225bd38715a25c1040cbad80f42"
283288
integrity sha512-fo0MWpVPSUrnZZhp9wyu+hhI3VJ9+Jhs+PWrokBTg3d2ryNPDOAWF1csIhQuYWBTn7KdZzXpRgpX2o6cwOlPWg==
284289

285-
"@types/supports-color@^7.2.0":
286-
version "7.2.0"
287-
resolved "https://registry.yarnpkg.com/@types/supports-color/-/supports-color-7.2.0.tgz#edd98ae52ee786b733a5dea0a23da4eb18ef7310"
288-
integrity sha512-gtUcOP6qIpjbSDdWjMBRNSks42ccx1709mwKTgelW63BESIADw8Ju7klpydDDb9Kr0iRXfpwrXH8+zoU8TCqiA==
290+
"@types/supports-color@^5.3.0":
291+
version "5.3.0"
292+
resolved "https://registry.yarnpkg.com/@types/supports-color/-/supports-color-5.3.0.tgz#eb6a52e9531fb3ebcd401cec774d1bdfb571f793"
293+
integrity sha512-WxwTXnHTIsk7srax1icjLgX+6w1MUAJbhyCpRP/45paEElsPDQUJZDgr1UpKuL2S3Tb+ZyX9MjWwmcSD4bUoOQ==
289294

290295
"@types/write-json-file@^3.2.1":
291296
version "3.2.1"
@@ -2170,7 +2175,7 @@ lodash.zip@^4.2.0:
21702175
resolved "https://registry.yarnpkg.com/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020"
21712176
integrity sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=
21722177

2173-
lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20:
2178+
lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.20:
21742179
version "4.17.21"
21752180
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
21762181
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

0 commit comments

Comments
 (0)