-
Notifications
You must be signed in to change notification settings - Fork 85
/
config.yml
595 lines (555 loc) · 19.7 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
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
version: 2.1
# Our CircleCI dependencies
orbs:
rust: circleci/rust@1.6.0
gh: circleci/github-cli@2.2.0
node: circleci/node@5.1.0
# 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:
amd_centos: &amd_centos_executor
docker:
- image: centos:7
resource_class: xlarge
environment:
XTASK_TARGET: "x86_64-unknown-linux-gnu"
CHECK_GLIBC: "true"
arm_ubuntu: &arm_ubuntu_executor
machine:
image: ubuntu-2004:2022.04.1
resource_class: arm.large
environment:
XTASK_TARGET: "aarch64-unknown-linux-gnu"
CHECK_GLIBC: "true"
amd_musl: &amd_musl_executor
docker:
- image: cimg/base:stable
resource_class: xlarge
environment:
XTASK_TARGET: "x86_64-unknown-linux-musl"
amd_macos: &amd_macos_executor
macos:
xcode: "14.2"
resource_class: macos.m1.large.gen1
environment:
XTASK_TARGET: "x86_64-apple-darwin"
APPLE_TEAM_ID: "YQK948L752"
APPLE_USERNAME: "opensource@apollographql.com"
# this is the exact same executor as amd_macos_executor (except $XTASK_TARGET)
# until there is official support for building on real ARM Macs
arm_macos: &arm_macos_executor
macos:
xcode: "14.2"
resource_class: macos.m1.large.gen1
environment:
XTASK_TARGET: "aarch64-apple-darwin"
APPLE_TEAM_ID: "YQK948L752"
APPLE_USERNAME: "opensource@apollographql.com"
amd_windows: &amd_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
amd_ubuntu: &amd_ubuntu_executor
machine:
image: ubuntu-2004:2022.04.1
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: medium
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 >>
# reusable parameters that can be used across jobs and workflows
parameters:
cache_version:
type: string
# increment this version to invalidate all caches
default: v2.{{ checksum "rust-toolchain.toml" }}
# 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: [amd_centos, amd_musl, amd_macos, amd_windows]
rust_channel: [stable]
command: [test]
- xtask:
name: Run supergraph-demo tests (<< matrix.rust_channel >> rust on << matrix.platform >>)
matrix:
parameters:
platform: [amd_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: [amd_centos, amd_musl, amd_macos, amd_windows]
rust_channel: [stable]
command: [test]
<<: *run_release
- xtask:
name: Run supergraph-demo tests (<< matrix.rust_channel >> rust on << matrix.platform >>)
matrix:
parameters:
platform: [amd_ubuntu]
rust_channel: [stable]
command: [integration-test]
<<: *run_release
- xtask:
name: Build and bundle release artifacts (<< matrix.platform >>)
matrix:
parameters:
platform: [amd_centos, amd_musl, arm_ubuntu, amd_macos, arm_macos, amd_windows]
rust_channel: [stable]
command: [package]
options: ["--rebuild"]
requires:
- "Run cargo tests + studio integration tests (stable rust on amd_centos)"
- "Run cargo tests + studio integration tests (stable rust on amd_musl)"
- "Run cargo tests + studio integration tests (stable rust on amd_macos)"
- "Run cargo tests + studio integration tests (stable rust on amd_windows)"
- "Run supergraph-demo tests (stable rust on amd_ubuntu)"
<<: *run_release
- publish_release:
name: Publish GitHub release and release to npm
matrix:
parameters:
platform: [volta]
requires:
- "Build and bundle release artifacts (amd_centos)"
- "Build and bundle release artifacts (arm_ubuntu)"
- "Build and bundle release artifacts (amd_musl)"
- "Build and bundle release artifacts (amd_macos)"
- "Build and bundle release artifacts (arm_macos)"
- "Build and bundle release artifacts (amd_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: ""
executor: << parameters.platform >>
steps:
- setup:
rust_channel: << parameters.rust_channel >>
platform: << parameters.platform >>
- when:
condition:
and:
# this wouldn't _have_ to be the macos executor, we just need
# to copy the schema exactly one time and not worry about it
# in other instances
- equal: [*amd_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: [*amd_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:
- setup:
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:
setup:
parameters:
rust_channel:
type: enum
enum: ["stable", "nightly"]
default: stable
platform:
type: executor
steps:
- install_system_deps:
platform: << parameters.platform >>
- checkout:
directory: "rover"
- install_rust_toolchain:
platform: << parameters.platform >>
rust_channel: << parameters.rust_channel >>
install_system_deps:
parameters:
platform:
type: executor
steps:
- when:
condition:
or:
- equal: [*amd_ubuntu_executor, << parameters.platform >>]
- equal: [*arm_ubuntu_executor, << parameters.platform >>]
- equal: [*amd_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: [*amd_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, OpenSSL, and git
command: yum -y install perl-core gcc openssl-devel openssl git
- run:
name: Check glibc version
command: ldd --version
- when:
condition:
equal: [*amd_musl_executor, << parameters.platform >>]
steps:
- run:
name: Install musl-tools and bash
command: sudo apt-get install -y musl-tools bash
- when:
condition:
or:
- equal: [*amd_macos_executor, << parameters.platform >>]
- equal: [*arm_macos_executor, << parameters.platform >>]
steps:
- run:
name: Skip homebrew update
command: echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $BASH_ENV
- run:
name: Install OpenSSL@1.1
command: brew install openssl@1.1
- 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
- run:
name: Install Rosetta 2
command: |
if [ "$(uname -m)" = "arm64" ]; then
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
else
echo "Rosetta 2 can only be installed on Apple Silicon!"
exit 1
fi
- install_volta:
platform: << parameters.platform >>
install_volta:
parameters:
platform:
type: executor
steps:
- unless:
condition:
or:
- equal: [*amd_windows_executor, << parameters.platform >>]
- equal: [*arm_ubuntu_executor, << parameters.platform >>]
steps:
- run:
name: Install volta
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: [*amd_windows_executor, << parameters.platform >>]
steps:
- run:
name: Install volta
command: |
choco install volta -y
- unless:
condition:
equal: [*arm_ubuntu_executor, << parameters.platform >>]
steps:
- 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:
- restore_cache:
keys:
- rust-<< pipeline.parameters.cache_version >>-<< parameters.platform >>-{{ checksum "Cargo.lock" }}
- rust-<< pipeline.parameters.cache_version >>-<< parameters.platform >>
- unless:
condition:
equal: [ *amd_windows_executor, << parameters.platform >> ]
steps:
- rust/install:
version: << parameters.rust_channel >>
- run:
name: Install specific rust toolchain
command: rustup target add $XTASK_TARGET
- run:
name: Unset rustup override
command: rustup override unset
- when:
condition:
equal: [ *amd_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: |
Set-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
platform:
type: executor
steps:
- run:
command: cargo xtask << parameters.command >> << parameters.options >>
- unless:
condition:
equal: [*amd_windows_executor, << parameters.platform >>]
steps:
- save_cache:
key: rust-<< pipeline.parameters.cache_version >>-<< parameters.platform >>-{{ checksum "Cargo.lock" }}-{{ checksum "rust-toolchain.toml" }}
paths:
- ~/.cargo/
- when:
condition:
equal: [*amd_windows_executor, << parameters.platform >>]
steps:
- save_cache:
key: rust-<< pipeline.parameters.cache_version >>-<< parameters.platform >>-{{ checksum "Cargo.lock" }}-{{ checksum "rust-toolchain.toml" }}
paths:
- C:\\Users\\circleci\.cargo
- 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 >>