1
1
version : 2.1
2
2
3
- # These "CircleCI Orbs" are reusable bits of configuration that can be shared
4
- # across projects. See https://circleci.com/orbs/ for more information.
5
3
orbs :
6
- # `oss` is a local reference to the package. The source for Apollo Orbs can
7
- # be found at http://github.com/apollographql/CircleCI-Orbs.
8
- oss : apollo/oss-ci-cd-tooling@0.0.20
9
- # win is a windows orb provided by circleci
10
- win : circleci/windows@2.4.1
4
+ node : circleci/node@5.0.2
11
5
12
6
commands :
13
- # These are the steps used for each version of Node which we're testing
14
- # against. Thanks to YAMLs inability to merge arrays (though it is able
15
- # to merge objects), every version of Node must use the exact same steps,
16
- # or these steps would need to be repeated in a version of Node that needs
17
- # something different. Probably best to avoid that, out of principle, though.
18
- common_test_steps :
19
- description : Commands to run on every Node.js environment
7
+ install-volta :
8
+ description : Install volta to manage Node/npm versions
20
9
steps :
21
- - oss/install_specific_npm_version :
22
- version : ' 7'
23
- - checkout
24
- - oss/npm_clean_install_with_caching
25
- - run : npm run circle
26
-
27
- # Important! When adding a new job to `jobs`, make sure to define when it
28
- # executes by also adding it to the `workflows` section below!
29
- jobs :
30
- # Platform tests, each with the same tests but different platform or version.
31
- NodeJS 12 :
32
- docker :
33
- - image : cimg/node:12.22.8
34
- steps :
35
- - common_test_steps
36
-
37
- NodeJS 14 Windows :
38
- executor :
39
- name : win/default
40
- environment :
41
- # Note: This is a no-op at the second, but bear with me on this. If this
42
- # comment is not removed by 2021-06-30 remove it along with the next line.
43
- # renovate: datasource=github-tags depName=nodejs/node versioning=node
44
- NODE_VERSION : 14.17.5
45
- NPM_VERSION : 7.10.0
46
- steps :
47
- - run : git config --global core.autocrlf false
48
10
- run :
49
- name : Install desired Node.js version with nvm
11
+ name : Install volta
12
+ # Teach the volta installer to update Circle's special env
13
+ # file instead of the default.
50
14
command : |
51
- nvm install ${Env:NODE_VERSION}
52
- nvm on
53
- - run :
54
- # https://github.com/coreybutler/nvm-windows/issues/300
55
- # Have to move the command out of the way because it can't
56
- # overwrite itself otherwise. This is madness, but apparently
57
- # accepted. Other things I tried: using yarn to install npm,
58
- # using http://npm.im/npm-windows-upgrade and even shouting.
59
- name : Install specific version of npm in a crazy Windows way
60
- command : |
61
- $node_dir = (get-item (get-command npm).source).directory.fullname
62
- foreach ($cmd in @("npm", "npx")) {
63
- foreach ($ext in @(".ps1", ".cmd", "")) {
64
- if (Test-Path "$node_dir/$cmd$ext") {
65
- rename-item -path (join-path -path $node_dir -childpath "$cmd$ext") "${cmd}-orig${ext}"
66
- }
67
- }
68
- }
69
- npm-orig install --global "npm@${Env:NPM_VERSION}"
70
- - run :
71
- name : Assert Node.js version
72
- command : |
73
- if ((node --version) -Ne "v${Env:NODE_VERSION}") { exit 1 }
74
- - run :
75
- name : Assert npm version
76
- command : |
77
- if ((npm --version) -Ne "${Env:NPM_VERSION}") { exit 1 }
78
- - checkout
79
- - oss/npm_clean_install_with_caching
80
- - run : npm run circle
15
+ curl https://get.volta.sh | PROFILE="$BASH_ENV" bash
81
16
82
- NodeJS 14 :
83
- docker :
84
- - image : cimg/node:14.18.2
17
+ setup-node :
18
+ parameters :
19
+ node-version :
20
+ type : string
21
+ default : " "
85
22
steps :
86
- - common_test_steps
87
- # We will save the results of this one particular invocation to use in
88
- # the publish step. Not only does this make the publishing step take less
89
- # time, this also ensures that a passing version gets deployed even if,
90
- # theoretically, rebuilding the same commit on the same version of
91
- # Node.js should yield the same results!
92
- - persist_to_workspace :
93
- root : .
94
- paths :
95
- - ./**
96
-
97
- NodeJS 16 :
98
- docker :
99
- - image : cimg/node:16.13.1
100
- steps :
101
- - common_test_steps
23
+ - install-volta
24
+ - checkout
25
+ - when :
26
+ condition : << parameters.node-version >>
27
+ steps :
28
+ - run : volta pin node@<< parameters.node-version >>
29
+ - run : node --version
30
+ - run : npm --version
31
+ - node/install-packages
102
32
103
- Publish GitHub Release :
33
+ jobs :
34
+ NodeJS :
35
+ parameters :
36
+ node-version :
37
+ type : string
104
38
docker :
105
- - image : cimg/go:1.17.8
39
+ - image : cimg/base:stable
106
40
steps :
107
- - attach_workspace :
108
- # Must be absolute path or relative path from working_directory
109
- at : .
110
- - run :
111
- name : " Publish Release on GitHub"
112
- command : |
113
- set +e
114
- test -d oclif-dist/channels && exit 1 || echo "Not a pre-release, continuing with publishing"
115
- /usr/local/go/bin/go get github.com/tcnksm/ghr
116
- VERSION=$(ls oclif-dist | cut -d 'v' -f2)
117
- echo "Publishing apollo@${VERSION} to GitHub Releases using ghr"
118
- ls ./oclif-dist/apollo-v${VERSION}/
119
- ghr -t ${GH_TOKEN} -c ${CIRCLE_SHA1} -delete apollo@${VERSION} "./oclif-dist/apollo-v${VERSION}/"
41
+ - setup-node :
42
+ node-version : <<parameters.node-version>>
43
+ - run : npm run test:ci
44
+ - store_test_results :
45
+ path : junit.xml
120
46
121
47
# Other tests, unrelated to typical code tests.
122
48
Linting :
123
49
docker :
124
- - image : cimg/node:12.22.8
50
+ - image : cimg/base:stable
125
51
steps :
126
- - oss/install_specific_npm_version :
127
- version : ' 7'
128
- - checkout
129
- # (speed) --ignore-scripts to skip unnecessary Lerna build during linting.
130
- - run : npm install --ignore-scripts
52
+ - setup-node
131
53
- run : npm run lint
132
54
133
55
Query Check :
134
56
docker :
135
- - image : cimg/node:12.22.8
57
+ - image : cimg/base:stable
136
58
steps :
137
- - oss/install_specific_npm_version :
138
- version : ' 7'
139
- - checkout
140
- - oss/npm_clean_install_with_caching
59
+ - setup-node
141
60
- run :
142
- name :
143
61
command : |
144
62
if [ -z "$CHECKS_API_KEY" ]; then
145
63
echo "NO CHECKS_API_KEY! CANNOT RUN! This is normal on PRs from Forks."
@@ -149,12 +67,9 @@ jobs:
149
67
150
68
Generated Types Check :
151
69
docker :
152
- - image : cimg/node:12.22.8
70
+ - image : cimg/base:stable
153
71
steps :
154
- - oss/install_specific_npm_version :
155
- version : ' 7'
156
- - checkout
157
- - oss/npm_clean_install_with_caching
72
+ - setup-node
158
73
- run :
159
74
name : Generate types locally and compare type files
160
75
command : |
@@ -165,84 +80,18 @@ jobs:
165
80
npx apollo client:codegen --key=$CHECKS_API_KEY --outputFlat --target=typescript currentTypes.ts
166
81
cmp --silent currentTypes.ts ./packages/apollo-language-server/src/graphqlTypes.ts || (echo "Type check failed. Run 'npm run client:codegen'" && exit 1)
167
82
168
- common_non_publish_filters : &common_non_publish_filters
169
- filters :
170
- # Ensure every job has `tags` filters since the publish steps have tags.
171
- # This is some wild configuration thing that's pretty hard to figure out.
172
- tags :
173
- only : /.*/
174
-
175
- common_publish_filters : &common_publish_filters
176
- filters :
177
- # Only run pre-publish and publish steps on specific tags.
178
- tags :
179
- only : /^publish\/[0-9]+$/
180
- # We want the publish to trigger on the above tag, not any branch.
181
- branches :
182
- ignore : /.*/
183
-
184
83
workflows :
185
84
version : 2
186
85
Build :
187
86
jobs :
188
- - NodeJS 12 :
189
- << : *common_non_publish_filters
190
- # - NodeJS 14 Windows:
191
- # <<: *common_non_publish_filters
192
- - NodeJS 14 :
193
- << : *common_non_publish_filters
194
- - NodeJS 16 :
195
- << : *common_non_publish_filters
196
- - Linting :
197
- << : *common_non_publish_filters
198
- - Query Check :
199
- << : *common_non_publish_filters
200
- - Generated Types Check :
201
- << : *common_non_publish_filters
202
- - oss/oclif_pack_from_verdaccio_storage :
203
- name : Build CLI
204
- package : apollo
205
- << : *common_non_publish_filters
206
- requires :
207
- - Package tarballs
208
- - oss/lerna_tarballs :
209
- name : Package tarballs
210
- << : *common_non_publish_filters
211
- requires :
212
- - NodeJS 12
213
- # - NodeJS 14 Windows
214
- - NodeJS 14
215
- - NodeJS 16
216
- - Publish GitHub Release :
217
- << : *common_publish_filters
218
- requires :
219
- - Confirmation
220
- - Build CLI
221
- - oss/dry_run :
222
- name : Dry-run
223
- << : *common_publish_filters
224
- requires :
225
- - NodeJS 12
226
- # - NodeJS 14 Windows
227
- - NodeJS 14
228
- - NodeJS 16
229
- - Build CLI
230
- - oss/confirmation :
231
- name : Confirmation
232
- type : approval
233
- << : *common_publish_filters
234
- requires :
235
- - Dry-run
236
- - Build CLI
237
- - oss/publish :
238
- name : Publish
239
- << : *common_publish_filters
240
- requires :
241
- - Confirmation
242
- # This "Dry-run" is also gated behind "Confirmation", but being left here
243
- # as a dependency in case "Confirmation" is ever removed from this workflow
244
- # so we have a clear picture of the actual dependency (as multiple go through
245
- # the Confirmation step).
246
- - Dry-run
247
-
248
-
87
+ - NodeJS :
88
+ name : NodeJS << matrix.node-version >>
89
+ matrix :
90
+ parameters :
91
+ node-version :
92
+ - " 12"
93
+ - " 14"
94
+ - " 16"
95
+ - Linting
96
+ - Query Check
97
+ - Generated Types Check
0 commit comments