-
Notifications
You must be signed in to change notification settings - Fork 85
/
config.yml
530 lines (493 loc) · 17.1 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
version: 2.1
# Our CircleCI dependencies
orbs:
rust: circleci/[email protected]
gh: circleci/[email protected]
node: circleci/[email protected]
# These filters are used in all of the jobs for our release workflow
run_release: &run_release
filters:
branches:
ignore: /.*/
tags:
only: /v.*/
# You can uncomment the following alias, and comment the above alias when testing,
# just make sure to update the branch name to the one you're testing on so they run.
# You can bypass the tests if you don't update those steps.
#
# run_release: &run_release
# filters:
# branches:
# only: /avery/test-release-process/
# tags:
# ignore: /.*/
# The machines we use to run our workflows on
executors:
centos: ¢os_executor
docker:
- image: centos:7
resource_class: xlarge
environment:
XTASK_TARGET: "x86_64-unknown-linux-gnu"
CHECK_GLIBC: "true"
musl: &musl_executor
docker:
- image: cimg/base:stable
resource_class: xlarge
environment:
XTASK_TARGET: "x86_64-unknown-linux-musl"
macos: &macos_executor
macos:
xcode: "13.4"
resource_class: medium
environment:
XTASK_TARGET: "x86_64-apple-darwin"
APPLE_TEAM_ID: "YQK948L752"
APPLE_USERNAME: "[email protected]"
MACOS_PRIMARY_BUNDLE_ID: com.apollographql.rover
windows: &windows_executor
machine:
image: "windows-server-2019-vs2019:stable"
resource_class: windows.xlarge
shell: powershell.exe -ExecutionPolicy Bypass
environment:
XTASK_TARGET: "x86_64-pc-windows-msvc"
# This is only used to run supergraph-demo since you can't run Docker from Docker
ubuntu: &ubuntu_executor
machine:
image: ubuntu-2004:202010-01
resource_class: xlarge
environment:
XTASK_TARGET: "x86_64-unknown-linux-gnu"
CAN_RUN_DOCKER: "true"
# This is used for any xtask command that needs volta installed
volta: &volta_executor
docker:
- image: cimg/base:stable
resource_class: small
environment:
XTASK_TARGET: "x86_64-unknown-linux-gnu"
tag_matches_prerelease: &tag_matches_prerelease
matches:
pattern: "^.*(beta|alpha|rc|prerelease|draft|test).*$"
value: << parameters.release_tag >>
# The main workflows executed for Rover
workflows:
lint:
jobs:
- xtask:
name: Lint
matrix:
parameters:
platform: [volta]
rust_channel: [stable]
command: [lint]
test:
jobs:
- xtask:
name: Run cargo tests + studio integration tests (<< matrix.rust_channel >> rust on << matrix.platform >>)
matrix:
parameters:
platform: [centos, musl, macos, windows]
rust_channel: [stable]
command: [test]
- xtask:
name: Run supergraph-demo tests (<< matrix.rust_channel >> rust on << matrix.platform >>)
matrix:
parameters:
platform: [ubuntu]
rust_channel: [stable]
command: [integration-test]
release:
jobs:
- xtask:
name: Run cargo tests + studio integration tests (<< matrix.rust_channel >> rust on << matrix.platform >>)
matrix:
parameters:
platform: [centos, musl, macos, windows]
rust_channel: [stable]
command: [test]
<<: *run_release
- xtask:
name: Run supergraph-demo tests (<< matrix.rust_channel >> rust on << matrix.platform >>)
matrix:
parameters:
platform: [ubuntu]
rust_channel: [stable]
command: [integration-test]
<<: *run_release
- xtask:
name: Build and bundle release artifacts (<< matrix.platform >>)
matrix:
parameters:
platform: [centos, musl, macos, windows]
rust_channel: [stable]
command: [package]
options: ["--verbose --rebuild"]
requires:
- "Run cargo tests + studio integration tests (<< matrix.rust_channel >> rust on << matrix.platform >>)"
- "Run supergraph-demo tests (stable rust on ubuntu)"
<<: *run_release
- publish_release:
name: Publish GitHub release and release to npm
matrix:
parameters:
platform: [volta]
requires:
- "Build and bundle release artifacts (centos)"
- "Build and bundle release artifacts (musl)"
- "Build and bundle release artifacts (macos)"
- "Build and bundle release artifacts (windows)"
<<: *run_release
jobs:
xtask:
parameters:
rust_channel:
type: enum
enum: ["stable", "nightly"]
default: stable
platform:
type: executor
command:
type: enum
enum: [lint, unit-test, integration-test, test, package]
options:
type: string
default: "--verbose"
executor: << parameters.platform >>
steps:
- checkout
- install_system_deps:
platform: << parameters.platform >>
rust_channel: << parameters.rust_channel >>
- when:
condition:
and:
- equal: [*macos_executor, << parameters.platform >>]
- equal: ["package", << parameters.command >>]
steps:
- exec_xtask:
platform: << parameters.platform >>
command: << parameters.command >>
options: << parameters.options >> --copy-schema
- unless:
condition:
and:
- equal: [*macos_executor, << parameters.platform >>]
- equal: ["package", << parameters.command >>]
steps:
- exec_xtask:
platform: << parameters.platform >>
command: << parameters.command >>
options: << parameters.options >>
publish_release:
parameters:
platform:
type: executor
executor: << parameters.platform >>
steps:
- checkout
- install_system_deps:
platform: << parameters.platform >>
rust_channel: stable
- attach_workspace:
at: artifacts
- gh/setup
- compute_checksums
- gh_release
- npm_publish
# reusable command snippets can be referred to in any `steps` object
commands:
install_system_deps:
parameters:
platform:
type: executor
rust_channel:
type: enum
enum: ["stable", "nightly"]
steps:
- when:
condition:
or:
- equal: [*ubuntu_executor, << parameters.platform >>]
- equal: [*musl_executor, << parameters.platform >>]
- equal: [*volta_executor, << parameters.platform >>]
steps:
- run:
name: Update apt repositories
command: sudo apt-get update
- run:
name: Check glibc version
command: ldd --version
- run:
name: Install OpenSSL
command: sudo apt-get install -y libssl-dev
- when:
condition:
equal: [*centos_executor, << parameters.platform >>]
steps:
- run:
name: Update and upgrade yum packages
command: yum -y update && yum -y upgrade
- run:
name: Install development tools
command: yum groupinstall -y "Development Tools"
- run:
name: Install gcc and OpenSSL
command: yum -y install perl-core gcc openssl-devel openssl
- run:
name: Check glibc version
command: ldd --version
- when:
condition:
equal: [*musl_executor, << parameters.platform >>]
steps:
- run:
name: Install musl-tools
command: sudo apt-get install -y musl-tools
- when:
condition:
equal: [*macos_executor, << parameters.platform >>]
steps:
- run:
name: Skip homebrew update
command: echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $BASH_ENV
- run:
name: Install [email protected]
command: brew install [email protected]
- run:
name: Install p7zip
command: brew install p7zip
- run:
name: Install curl
# we need to override the system curl because of outdated CA certificates
# on the base macos image
command: |
brew install curl
echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> $BASH_ENV
- install_volta:
platform: << parameters.platform >>
- install_rust_toolchain:
rust_channel: << parameters.rust_channel >>
platform: << parameters.platform >>
install_volta:
parameters:
platform:
type: executor
steps:
- unless:
condition:
equal: [*windows_executor, << parameters.platform >>]
steps:
- run:
name: Install volta
shell: bash
command: |
curl https://get.volta.sh | bash -s -- --skip-setup
echo 'export VOLTA_HOME=$HOME/.volta' >> $BASH_ENV
echo 'export PATH=$VOLTA_HOME/bin:$PATH' >> $BASH_ENV
- when:
condition:
equal: [*windows_executor, << parameters.platform >>]
steps:
- run:
name: Install volta
command: |
$installer_dir = "$Env:TEMP".Path
$latest_version = ((Invoke-WebRequest -URI https://volta.sh/latest-version).Content -split '\n')[0]
$download_url = "https://github.com/volta-cli/volta/releases/download/v$latest_version/volta-$latest_version-windows-x86_64.msi"
echo "Downloading volta"
$msi_path = "$installer_dir\volta-init.msi"
(New-Object System.Net.WebClient).DownloadFile("$download_url", "$msi_path")
echo "Installing volta"
msiexec.exe /i "$msi_path" /qn
exit $LASTEXITCODE
- run:
name: Install default versions of npm and node
command: |
volta install node@16
volta install npm@7
install_rust_toolchain:
parameters:
rust_channel:
type: enum
enum: ["stable", "nightly"]
platform:
type: executor
steps:
- unless:
condition:
equal: [ *windows_executor, << parameters.platform >> ]
steps:
- rust/install:
version: << parameters.rust_channel >>
- run:
name: Install specific rust toolchain
command: rustup target add $XTASK_TARGET
- when:
condition:
equal: [ *windows_executor, << parameters.platform >> ]
steps:
- run:
name: Install rustup
environment:
# Override auto-detection of RAM for rustc install.
# https://github.com/rust-lang/rustup/issues/2229#issuecomment-585855925
RUSTUP_UNPACK_RAM: "21474836480"
command: |
$installer_dir = "$Env:TEMP"
echo "Downloading rustup"
(New-Object System.Net.WebClient).DownloadFile("https://win.rustup.rs/x86_64", "$installer_dir\rustup-init.exe")
echo "Installing rustup"
& $installer_dir\rustup-init.exe --profile minimal -y
exit $LASTEXITCODE
- run:
name: Configure cargo for Windows
command: |
Add-Content -path "${Env:USERPROFILE}\.cargo\config.toml" @"
[net]
git-fetch-with-cli = true
"@
exec_xtask:
parameters:
command:
type: enum
enum: [lint, integration-test, unit-test, test, package]
options:
type: string
default: --verbose
platform:
type: executor
steps:
- restore_cache:
keys:
- rust-target-v2-<< parameters.platform >>-{{ checksum "Cargo.lock" }}
- run:
command: cargo xtask << parameters.command >> << parameters.options >>
- save_cache:
key: rust-target-v2-<< parameters.platform >>-{{ checksum "Cargo.lock" }}
paths:
- target/
- when:
condition:
equal: [package, << parameters.command >>]
steps:
- persist_to_workspace:
root: artifacts
paths:
- "*"
gh_release:
steps:
- unless:
condition: << pipeline.git.tag >>
steps:
- run:
command: >
mkdir -p artifacts && cd artifacts && echo "this release is part of a test, please ignore." >> this_is_a_fake_release.txt
- exec_gh_release:
release_tag: << pipeline.git.branch >>
extra_options: "--draft"
- when:
condition: << pipeline.git.tag >>
steps:
- exec_gh_release
exec_gh_release:
parameters:
release_tag:
type: string
default: << pipeline.git.tag >>
extra_options:
type: string
default: ""
steps:
- when:
condition:
<<: *tag_matches_prerelease
steps:
- run:
name: Create GitHub prerelease
command: |
gh release create << parameters.release_tag >> \
--prerelease \
--title << parameters.release_tag >> \
<< parameters.extra_options >> \
--notes '<!-- changelog -->
---
This release was automatically created by [CircleCI](./.circleci/config.yml).
If you would like to verify that the binary you have downloaded was built from the source code in this repository, you can compute a checksum of the zipped tarball and compare it to the checksums that are included as release artifacts.
Binaries built for MacOS are signed, notarized, and automatically verified with [Gatekeeper](https://support.apple.com/guide/deployment-reference-macos/using-gatekeeper-apd02b925e38/web).' \
artifacts/*
- unless:
condition:
<<: *tag_matches_prerelease
steps:
- run:
name: Create GitHub release
command: |
gh release create << parameters.release_tag >> \
--title << parameters.release_tag >> \
<< parameters.extra_options >> \
--notes '<!-- changelog -->
---
This release was automatically created by [CircleCI](./.circleci/config.yml).
If you would like to verify that the binary you have downloaded was built from the source code in this repository, you can compute a checksum of the zipped tarball and compare it to the checksums that are included as release artifacts.
Binaries built for MacOS are signed, notarized, and automatically verified with [Gatekeeper](https://support.apple.com/guide/deployment-reference-macos/using-gatekeeper-apd02b925e38/web).' \
artifacts/*
compute_checksums:
steps:
- run:
name: Compute SHA256 checksums
command: >
cd artifacts && sha256sum *.tar.gz > sha256sums.txt
- run:
name: Compute md5 checksums
command: >
cd artifacts && md5sum *.tar.gz > md5sums.txt
- run:
name: Compute SHA1 checksums
command: >
cd artifacts && sha1sum *.tar.gz > sha1sums.txt
npm_publish:
steps:
- unless:
condition: << pipeline.git.tag >>
steps:
- exec_npm_publish:
options: "--dry-run"
release_tag: << pipeline.git.branch >>
- when:
condition: << pipeline.git.tag >>
steps:
- exec_npm_publish
exec_npm_publish:
parameters:
options:
type: string
default: ""
npm_dir:
type: string
default: "./installers/npm"
release_tag:
type: string
default: << pipeline.git.tag >>
steps:
- run:
name: Create .npmrc for publishing
command: |
cat \<<'EOF' > ~/.npmrc
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
EOF
- unless:
condition:
<<: *tag_matches_prerelease
steps:
- run:
name: Publish to npm (stable)
command: cd << parameters.npm_dir >> && npm publish << parameters.options >>
- when:
condition:
<<: *tag_matches_prerelease
steps:
- run:
name: Publish to npm (beta)
command: cd << parameters.npm_dir >> && npm publish --tag beta << parameters.options >>