Skip to content

Commit 434650f

Browse files
committed
chore: circleci for matrix builds across win, mac, and linux for node v14 - v20
1 parent 6aa0eb2 commit 434650f

1 file changed

Lines changed: 124 additions & 0 deletions

File tree

.circleci/config.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
#
3+
# This build use extensive use of parameters
4+
# https://circleci.com/docs/reusing-config/#using-the-parameters-declaration
5+
#
6+
# And Conditional Steps
7+
# https://circleci.com/docs/reusing-config/#defining-conditional-steps
8+
9+
version: 2.1
10+
11+
orbs:
12+
node: circleci/node@5.2.0
13+
14+
commands:
15+
project-setup:
16+
parameters:
17+
working-dir:
18+
type: string
19+
node-version:
20+
type: string
21+
windows:
22+
type: boolean
23+
default: false
24+
steps:
25+
- checkout:
26+
path: << parameters.working-dir >>
27+
- when:
28+
condition:
29+
equal: [ true, << parameters.windows >> ]
30+
steps:
31+
- run:
32+
name: nvm-install
33+
command: choco install nvm -y
34+
- run:
35+
name: node-install
36+
command: |
37+
Start-Process powershell -verb runAs -Args "-start GeneralProfile"
38+
nvm install << parameters.node-version >>
39+
nvm use << parameters.node-version >>
40+
- run:
41+
name: npm-install
42+
command: npm ci
43+
- when:
44+
condition:
45+
equal: [ false, << parameters.windows >> ]
46+
steps:
47+
- node/install:
48+
node-version: << parameters.node-version >>
49+
install-yarn: false
50+
- node/install-packages:
51+
check-cache: always
52+
pkg-manager: npm
53+
with-cache: false
54+
55+
lint-test:
56+
steps:
57+
- run:
58+
command: npm run posttest
59+
60+
unit-test:
61+
steps:
62+
- run:
63+
command: npm run test
64+
65+
66+
executors:
67+
linux: # a Linux VM running Ubuntu 20.04
68+
docker:
69+
- image: cimg/base:2024.01
70+
working_directory: /home/circleci/project/c8
71+
macos: # macos executor running Xcode
72+
macos:
73+
xcode: 14.2.0
74+
working_directory: /Users/distiller/project/c8
75+
win:
76+
machine:
77+
image: 'windows-server-2019-vs2019:2023.10.1'
78+
resource_class: windows.medium
79+
shell: powershell.exe -ExecutionPolicy Bypass
80+
working_directory: C:\Users\circleci\project\c8
81+
82+
jobs:
83+
# Refactor to a command
84+
test:
85+
parameters:
86+
os:
87+
type: string
88+
node-version:
89+
type: string
90+
executor: << parameters.os >>
91+
steps:
92+
- when:
93+
condition:
94+
equal: [ linux, << parameters.os >> ]
95+
steps:
96+
- project-setup:
97+
node-version: << parameters.node-version >>
98+
working-dir: /home/circleci/project/c8
99+
- when:
100+
condition:
101+
equal: [ win , << parameters.os >> ]
102+
steps:
103+
- project-setup:
104+
node-version: << parameters.node-version >>
105+
working-dir: C:\Users\circleci\project\c8
106+
windows: true
107+
- when:
108+
condition:
109+
equal: [ macos, << parameters.os >> ]
110+
steps:
111+
- project-setup:
112+
node-version: << parameters.node-version >>
113+
working-dir: /Users/distiller/project/c8
114+
- lint-test
115+
- unit-test
116+
117+
workflows:
118+
matrix-test:
119+
jobs:
120+
- test:
121+
matrix:
122+
parameters:
123+
os: [win, linux, macos]
124+
node-version: ["14.21.3", "16.20.2", "18.19.0", "20.11.0"]

0 commit comments

Comments
 (0)