/
config.yml
137 lines (125 loc) 路 3.53 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# CircleCI configuration
# https://circleci.com/docs/configuration-reference/
version: 2.1
orbs:
win: circleci/windows@2.4.0
references:
# For stability, Node.js versions we run against in CI are defined explicitly
# (the "lts" alias may bring in a future version before we support it)
node_supported_lts_versions: &node_supported_lts_versions
- &node_min_supported_version "14.17"
- "16.18"
- "18.12"
node_lts_image: &node_lts_image cimg/node:18.12
secure_unset_publish_token: &secure_unset_publish_token
environment:
NPM_TOKEN: ""
commands:
yarn_install:
description: "A wrapper to yarn install with caching"
parameters:
working_directory:
type: string
default: ""
steps:
- restore_cache:
keys:
- dependencies-{{ .Branch }}-{{ checksum "yarn.lock" }}
- dependencies-{{ .Branch }}-
- run:
name: Installing dependencies
command: yarn --frozen-lockfile --non-interactive --ignore-scripts
working_directory: << parameters.working_directory >>
- save_cache:
paths:
- node_modules
key: dependencies-{{ .Branch }}-{{ checksum "yarn.lock" }}
install_and_run_tests:
description: |
Install dependencies and run tests (common steps for test-<platform> jobs)
steps:
- yarn_install
- run: yarn jest --ci --maxWorkers 4 --reporters=default --reporters=jest-junit
- store_test_results:
path: ./reports/
jobs:
run-js-checks:
<<: *secure_unset_publish_token
docker:
- image: *node_lts_image
steps:
- checkout
- yarn_install
- run: yarn typecheck
- run: yarn lint
- run: yarn test-smoke
test-with-coverage:
<<: *secure_unset_publish_token
docker:
- image: *node_lts_image
steps:
- checkout
- yarn_install
- run: yarn test-coverage
- run:
name: Download Codecov Uploader
command: ./.circleci/scripts/install_codecov.sh
- run:
name: Upload coverage results
command: ./codecov -t ${CODECOV_TOKEN} -f ./coverage/coverage-final.json
test-linux:
<<: *secure_unset_publish_token
parameters:
node-version:
type: string
docker:
- image: cimg/node:<< parameters.node-version >>
steps:
- checkout
- install_and_run_tests
test-windows:
<<: *secure_unset_publish_token
parameters:
node-version:
type: string
executor:
name: win/default
steps:
- checkout
- run:
name: Install Node.js and Yarn
command: |
choco install -y nodejs --version << parameters.node-version >>
choco install -y yarn
- install_and_run_tests
publish-to-npm:
docker:
- image: *node_lts_image
steps:
- checkout
- yarn_install
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: npm run publish
- run: rm ~/.npmrc
workflows:
build-and-deploy:
jobs:
- run-js-checks
- test-with-coverage
- test-linux:
matrix:
parameters:
node-version: *node_supported_lts_versions
- test-windows:
matrix:
parameters:
node-version: [*node_min_supported_version]
filters:
branches:
only: /windows\/.*/
- publish-to-npm:
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*/