-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathconfig.yml
389 lines (359 loc) · 12.3 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
version: 2.1
# Our CircleCI dependencies
orbs:
rust: circleci/[email protected]
gh: circleci/[email protected]
# These filters are used to determine which package to release
any_release: &any_release
filters:
branches:
ignore: /.*/
tags:
only : /(apollo-federation-types@v.*)|(router-bridge@v.*)|(composition@v.*)/
# These filters are used to determine which package to release
crate_release: &crate_release
filters:
branches:
ignore: /.*/
tags:
only : /(apollo-federation-types@v.*)|(router-bridge@v.*)/
# These filters are used to determine which package to release
composition_release: &composition_release
filters:
branches:
ignore: /.*/
tags:
only : /(composition@v.*)/
# The main workflows executed for federation-rs
workflows:
lint:
jobs:
- xtask:
name: Lint
matrix:
parameters:
platform: [centos]
rust_channel: [stable]
command: [lint]
test:
jobs:
- xtask:
name: Run cargo tests (<< matrix.rust_channel >> rust on << matrix.platform >>)
matrix:
parameters:
platform: [centos, macos, windows]
rust_channel: [stable]
command: [test]
release:
jobs:
- xtask:
name: Run cargo tests (<< matrix.rust_channel >> rust on << matrix.platform >>)
matrix:
parameters:
platform: [centos, macos, windows]
rust_channel: [stable]
command: [test]
<<: *any_release
- xtask:
name: Build and bundle release artifacts (<< matrix.platform >>)
matrix:
parameters:
platform: [centos, macos, windows]
rust_channel: [stable]
command: [package]
options: ["--verbose"]
requires:
- "Run cargo tests (<< matrix.rust_channel >> rust on << matrix.platform >>)"
<<: *composition_release
- publish_release:
name: Publish to crates.io and create a GitHub release
matrix:
parameters:
platform: [minimal_linux]
requires:
- "Build and bundle release artifacts (centos)"
- "Build and bundle release artifacts (macos)"
- "Build and bundle release artifacts (windows)"
<<: *composition_release
- publish_release:
name: Publish to crates.io
matrix:
parameters:
platform: [minimal_linux]
requires:
- "Run cargo tests (stable rust on centos)"
- "Run cargo tests (stable rust on macos)"
- "Run cargo tests (stable rust on windows)"
<<: *crate_release
jobs:
xtask:
parameters:
rust_channel:
type: enum
enum: ["stable", "nightly"]
default: stable
platform:
type: executor
command:
type: enum
enum: [lint, test, publish, package, dist]
options:
type: string
default: "--verbose"
executor: << parameters.platform >>
steps:
- checkout
- install_system_deps:
platform: << parameters.platform >>
rust_channel: << parameters.rust_channel >>
- exec_xtask:
platform: << parameters.platform >>
command: << parameters.command >>
options: << parameters.options >>
publish_release:
parameters:
platform:
type: executor
executor: << parameters.platform >>
steps:
- checkout
# we persisted the artifacts from `cargo xtask package`
# across all of our architectures earlier
- attach_workspace:
at: artifacts
- install_system_deps:
platform: << parameters.platform >>
rust_channel: stable
- compute_checksums
# this is run in order to create the JavaScript bundles
# that are needed by `cargo xtask publish`
- exec_xtask:
platform: << parameters.platform >>
command: dist
options: --verbose --debug
# this should be run before the GitHub release is created
# because it ensures that all of the files it needs
# are in place before proceeding.
- exec_xtask:
platform: << parameters.platform >>
command: publish
- gh_release
# The machines we use to run our workflows on
executors:
macos: &macos_executor
macos:
xcode: "11.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.supergraph
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"
centos: ¢os_executor
docker:
- image: centos:7
resource_class: xlarge
environment:
XTASK_TARGET: "x86_64-unknown-linux-gnu"
minimal_linux:
docker:
- image: cimg/base:stable
resource_class: small
environment:
XTASK_TARGET: "x86_64-unknown-linux-gnu"
# 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:
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: [ *macos_executor, << parameters.platform >> ]
steps:
- run:
name: Skip homebrew update
command: echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $BASH_ENV
- run:
name: Install curl
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
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 >>
- 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, test, publish, package, dist]
options:
type: string
default: --verbose
platform:
type: executor
working_directory:
type: string
default: ./
steps:
- restore_cache:
keys:
- rust-target-v1-<< parameters.platform >>-{{ checksum "Cargo.lock" }}
- run:
command: cargo xtask << parameters.command >> << parameters.options >>
working_directory: << parameters.working_directory >>
- save_cache:
key: rust-target-v1-<< parameters.platform >>-{{ checksum "Cargo.lock" }}
paths:
- target/
- when:
condition:
equal: [ package, << parameters.command >> ]
steps:
- persist_to_workspace:
root: artifacts
paths:
- "*"
compute_checksums:
steps:
- when:
condition:
matches:
pattern: "/(composition@v.*)/"
value: << pipeline.git.tag >>
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
gh_release:
steps:
- when:
condition:
matches:
pattern: "/(composition@v.*)/"
value: << pipeline.git.tag >>
steps:
- gh/setup
- run:
name: Create GitHub release
environment:
RELEASE_NAME: "$(echo << pipeline.git.tag >> | sed s/composition/supergraph/)"
command: |
RELEASE_NAME="$(echo $CIRCLE_TAG | sed s/composition/supergraph/)" && gh release create $RELEASE_NAME \
--title $RELEASE_NAME \
--notes '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/*